Jump to content
Sign in to follow this  
rtruxler

OFP material in CfgMaterials

Recommended Posts

hey everyone. I'm using O2 to make a model that I want to appear totally green (no lighting applied, just color rgb=0,1,0)). I've tried (to no avail) using a material definition in config.cpp, here's what I have:

class CfgTextureToMaterial
{
class GNTAn12Shine
{
	textures[]=
	{
		"green.paa"
	};
	material="#GREEN_material";
};
};


class CfgMaterials
{
class GREEN_material {
	ambient[]={0.000000,1.000000,0.000000,1.000000};
	diffuse[]={0.000000,1.000000,0.000000,1.000000};
	forcedDiffuse[]={0.000000,0.000000,0.000000,1.000000};
	emmisive[]={0.000000,1.000000,0.000000,1.000000};
	specular[]={0.000000,1.000000,0.000000,1.000000};
	specularPower=60.000000;
	PixelShaderID="Normal";
	VertexShaderID="Basic";

};
};

All of the faces in my model refer to a (non-existent) texture called "green.paa," and I'm expecting the config.cpp to translate those texture references to the above material. Is this correct?

When I fire up OFP, I see my model but it's grey instead of green, and it has lighting still.

Any help?

Share this post


Link to post
Share on other sites

Have you tried in O2 to :

-select your model

-select Point

-select Properties

-select either Fully Lighted or Always in Shadow

As an example of what those do to the lighting :

555rwy.jpg

Share this post


Link to post
Share on other sites

Yup, I've done that, and it seems like it's mostly working, although there's one face that still appears slightly brighter than the rest. I have all points set as "fully lighted" and the whole model appears grey except for one face which is white. But what's more frustrating is that I'm trying to make it all solid green and that's having no effect. Is there a way to set the vertex colors in O2? I tried changing the face color in O2, but that just appears how it looks in the 3D preview window. When I export, binarize, etc. it still is white.

What should I set the face properties be so that it properly gets assigned my material in the config.cpp? Should I give it the fake green.paa texture or should I set its material to "GREEN_material" ? I can tell that when I change the config.cpp it's having no effect, so I probably just haven't set the right value in the right place on the 3d model.

Thanks!

Share this post


Link to post
Share on other sites

From what i remember the CfgTextureToMaterial only works on binarized p3d.

A face appear white ingame when it does not have a texture assigned, or if it does not find the texture (as your green.paa does not exist) it has been assigned with.

Try this :

download this greeny.rar file :

http://www.filefront.com/14339909/greeny.rar

inside of it there is a small 64x64 greeny.pac texture that is only 1 color : pure green (RGB values 0,255,0)

Put this texture in your model pbo

Now in O2 select your model (in case you can't do that, just press CTRL+A or select Edit -> Select All to be sure you don't miss a face)

Select now Faces -> Properties

In the bottom, assign this greeny.pac texture, be carefull to point to the pbo that contain the texture (so it does not appear white).

Clic on Apply/Ok

Preview your model to be sure everything is correctly in green to see if you made a mistake or forgot something.

Now again select all (ctrl+A) select Point, Properties and give either fully lighted or always in shadow depending on whatever you want.

Save your model and see how it is ingame

Share this post


Link to post
Share on other sites

The fully-lighted property on the vertices is having no effect... I have flat shading across the faces, but each face still has different intensities in OFP.

greenscreent.th.jpg

Maybe this is a problem with using oxygen 2 to export old p3d versions to ofp? Maybe I gotta go get the old oxygen version?

Thanks for the help by the way.

Share this post


Link to post
Share on other sites

Possible, i don't use the new version of O2, not having ArmA and it may have some specific changes in the various formats that could make things not totally compatible with the old p3d format.

I just tried to build a green box like in your screenshot, and encounter absolutely no problem like you.

I wonder, have you made the edge sharp ?

Because i made mine smooth and there is no lighting change for each face.

I didn't binarized them and just had this as a config, i made no CfgModels section and no CfgTextureToMaterial :

// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2

#define WeaponNoSlot				0// dummy weapons
#define WeaponSlotPrimary		1// primary weapons
#define WeaponSlotSecondary	16// secondary weapons
#define WeaponSlotItem			256// items
#define WeaponSlotBinocular	4096// binocular
#define WeaponHardMounted		65536

class CfgPatches
{

class GBox
	{
	units[]={"GreenBox1"};
	weapons[]={};
	requiredAddons[]= {};
	requiredVersion=1.85;
	};
};


class CfgVehicles
{
class All
	{
	};

class Static:All
	{
	};

class Building:Static
	{
	};

class NonStrategic:Building
	{
	};

class GreenBox1:NonStrategic
	{
	scope=2;
	model="\greenbox\box1.p3d";
	displayName="Green Box";
	vehicleClass="Objects";
	icon="Unknown_object";
	nameSound="helipad";
	accuracy=0.2;
	typicalCargo[]={};
	transportAmmo=0;
	transportRepair=0;
	transportFuel=0;
	mapSize=9.8000002;
	cost=0;
	armor=20000000;
	};

};

Share this post


Link to post
Share on other sites

I use oxygen 2 for OFP becouase I can't see any textures in the old oxygen and also it does have some cool new features :) The only thing that dosent work when saving a model in Oxygen 2 are hidden selections so I have to export the model to old .p3d, open it in oxygen 1 and then make the hidden selections there :)

Share this post


Link to post
Share on other sites

rtruxler,

It's probably related to the version of O2 you're using.

If you use "fully lighted",to indicate that the faces should

be lit equally at all times,and have all faces set to smooth,

then it should look like solid colour with no noticable features.

You only need to binarize to bind Cfgmaterials to the model.

But you don't need to do that in your case.

-Martin-,

If you can't see textures in O2 light;ie,the model appears white,

then it's simply because the textures can't be located.

Try putting your addon folders directly into the O2 folder.

Edited by Macser

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×