Jump to content
Sign in to follow this  
bravo 6

grassclutter .rvmat codes

Recommended Posts

For a while i have been testing and looking for the best .rvmat code for a Grass model clutter and yet couldn't find the best "Formula".

These are the most common and used grass clutter .rvmat:

1 - Test 1

Observation: Transparent, good color but bugged (we can see backside clutters in 1st plan)

mainLight = "Sun";
fogMode = "Fog";

ambient[] = {0.5, 0.5, 0.5, 1.0};
diffuse[] = {0.5, 0.5, 0.5, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 1.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 1.0};
specularPower = 1.0;

PixelShaderID = "Normal";
VertexShaderID = "Basic";

renderFlags[] = {"AlphaInstancing", "NoZWrite"};

Buldozer picture , InGame picture 1, InGame picture 2 , InGame picture 3

2 - Test 2

Observation: Transparent, color endings are very hard and rude. *bugged (we can see backside clutters in 1st plan)

mainLight = "Sun";
fogMode = "Fog";

ambient[] = {0.5, 0.5, 0.5, 1.0};
diffuse[] = {0.5, 0.5, 0.5, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 1.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 1.0};
specularPower = 1.0;

PixelShaderID = "Grass";
VertexShaderID = "Basic";

renderFlags[] = {"AlphaInstancing", "NoZWrite"};

Buldozer picture , InGame picture

3 - BIS original rvmat:

Observation: No Bug but the color and endings are very hard and rude.

mainLight = "Sun";
fogMode = "Fog";

ambient[] = {0.4, 0.4, 0.4, 1.0};
diffuse[] = {0.4, 0.4, 0.4, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 1.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 1.0};
specularPower = 1.0;

PixelShaderID = "Grass";
VertexShaderID = "Basic";

renderFlags[] = {"AlphaInstancing", "AlphaTest32"};

Buldozer picture , InGame picture

4 - Queen Gambit original rvmat:

Observation: Same as BIS Original, No Bug but the color and ending are very hard and rude.

mainLight = "Sun";
fogMode = "Fog";

ambient[] = {0.7, 0.7, 0.7, 1.0};
diffuse[] = {0.9, 0.9, 0.9, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 1.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.0, 0.0, 0.0, 1.0};
specularPower = 1.0;

PixelShaderID = "Grass";
VertexShaderID = "Basic";

renderFlags[] = {"AlphaInstancing", "AlphaTest32"};

Buldozer picture , InGame picture

5 - Mikebart's Grass rvmat:

Observation: Good colors, but theres a empty surrounding area around hole texture that blocks whats exists behind it, creating a small transparent and visible line around the texture.

mainLight = "Sun";
fogMode = "Fog";

ambient[] = {1.5,1.5,1.5,1};
diffuse[] = {0.4,0.4,0.4,1};
forcedDiffuse[] = {0,0,0,1};
emmisive[] = {0,0,0,1};
specular[] = {0,0,0,1};
specularPower = 1;

PixelShaderID = "Grass";
VertexShaderID = "BasicAlpha";

renderFlags[] = {"AlphaInstancing","AlphaTest96"};

Buldozer picture , InGame picture 1 , InGame picture 2 , InGame picture 3 , InGame picture 4 *(same code but different map area)

From what i understood while testing and looking for the best visual effect i noticed that the following lines are the responsible for the observations i mentioned:

PixelShaderID

VertexShaderID

renderFlags.

Question:

Is there a way to create an visual effect similar in 5 without that transparent and visible line around the model in order to make it look like in 1

Ie, whats the best way of doing it to have a result like 1 but with out having the background clutters appearing in 1st plan.

edit1: I wanted to add the link because i tried several options and didn't found what i was looking for.

ArmA RVMAT

edit2: Fixed the strange characters to fit the new forum.

Edited by bravo 6

Share this post


Link to post
Share on other sites

Very nice post bravo 6!

IMO buldozer impression is not enough.

After all ingame most likely looks very different and I assume the

different settings have a FPS impact.

Especially different lighting and clutter and composition density

can make it look very different from the simple buldozer setup.

Share this post


Link to post
Share on other sites

Ingame pictures were added into the first post so people can see better the differences i wanted to say.

Forget about the colors it self, notice more the edges of the textures.

Now, is there any solution for the last case <span style='color:blue'>5</span>?

Share this post


Link to post
Share on other sites

Thanks!

I don't quite get the problem of 1:

> we can see backside clutters in 1st plan

If you use only one type of clutter, 5 would be okay or does the

problem also apply for other objects?

Share this post


Link to post
Share on other sites
Thanks!

I don't quite get the problem of 1:

> we can see backside clutters in 1st plan

The problem i referred in 1 can be clearly confirmed in the following pictures:

Picture 1

Picture 2

If you use only one type of clutter, 5 would be okay or does the

problem also apply for other objects?

I think it also applies for other objects.

edit: Problem of 5 is this Picture

Share this post


Link to post
Share on other sites

How about Case 5 with the following:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">renderFlags[] = {"AlphaInstancing","AlphaTest96","NoZWrite"};

I don't have all that much experience with RVMATs, so that probably wont work, or you've already tried it. Either way, I figured I'd throw the idea out there on the off-chance it does actually work.

Alternatively, use 5 as it is now, and simply increase the coloured area of the texture surrounding the grass (i.e. give the detailled grass texture a tan background, that wya when the alpha channel creates the "ghost outline" it will just be tan and far less noticeable (hopefully).

Share this post


Link to post
Share on other sites

Hey thanks for posting this up Bravo 6, very helpful and just the kind of info i've been looking for.

with the way 5 is, it doesnt matter how much you cut back the alpha or colour the edges, you still get that surrounding transparent line and the alphatest renderflag doesnt seem to work with these shaders, so you cant use it to cut that line back either, if it could be used maybe it could solve those problems.

If you have alot of clutter together, its pretty hard to notice that surrounding transparent line (could be because im using 2048's), it only seems to appear within the model itself and it looks/blends fine against other clutter with the same .rvmat applied, including its own instance.

grass05.th.jpg

I put the #5 rvmat on the bodiac group, and you can see you get some of that edge artifact within the model but it blends fine against the grass, although it would be nice to get rid it entirely, it only really seems to be happening on a minority of faces.

Share this post


Link to post
Share on other sites

Thanks again for the pics. Very helpful!

In 1&2 only the stones can be seen through right?

For all of em I am not really sure how much of an issue it really

is. After all its a matter of perspective and normally you are

not laying down that much.

---

Can these rvmat settings also be applied to the standard arma

vegetation (bushes and trees) - any idea?

Share this post


Link to post
Share on other sites

First off, let's say that the renderflag Alphatest96 is unexistant. It must be 32-64-128-256-512. That causes the transparent bug.

Also, there's no way to have smooth colors without problems, or in simple words:

Smooth textures like in 1, without the bug in 5.

Anyway, the best RVMAT to use with grass clutter is

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ambient[] = {0.4,0.4,0.4,1};

diffuse[] = {0.4,0.4,0.4,1};

forcedDiffuse[] = {0,0,0,1};

emmisive[] = {0,0,0,1};

specular[] = {0,0,0,1};

specularPower = 1;

PixelShaderID = "Grass";

VertexShaderID = "Basic";

mainLight = "Sun";

renderFlags[] = {"AlphaInstancing","AlphaTest64"};

fogMode = "Fog";

Quote[/b] ]Can these rvmat settings also be applied to the standard arma

vegetation (bushes and trees) - any idea?

nope, cause bushes and trees uses also Normal map (*_non  extension)

Share this post


Link to post
Share on other sites

you might try...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ambient[]={0.4,0.4,0.4,1};

diffuse[]={0.4,0.4,0.4,1};

forcedDiffuse[]={0,0,0,1};

emmisive[]={0,0,0,1};

specular[]={0,0,0,1};

specularPower=1;

PixelShaderID="Grass";

VertexShaderID="Basic";

mainLight="Sun";

fogMode="Fog";

renderFlags[]={"AddBlend","AlphaTest64"};

... possibly the 'AddBlend' is worthless in this particular circumstance... suck it an see... or you could try adding a 2nd stage material, but from memory having a 2nd stage on grass caused some poping.

btw, although renderFlag 'AlphaInstancing' is mentioned in some of the BIS .rvmat's I believe it maybe an 'Unknown renderFlag' to binarize.exe, so probably a waste of time.

Share this post


Link to post
Share on other sites
In 1&2 only the stones can be seen through right?

For all of em I am not really sure how much of an issue it really

is. After all its a matter of perspective and normally you are

not laying down that much.

---

Can these rvmat settings also be applied to the standard arma

vegetation (bushes and trees) - any idea?

@Q - From what i understand and experienced only clutters like stones and bushes pass to 1st plan creating the issue we can see in 1.

When detecting the issue you see the rocks but you also see the desert bush (green color) appearing in first plan too.

Though there is no problem when one normal object (house, tree, car) is behind, the object does not pass to 1st plan like the clutters. It only happens with and among clutter. But why?

@Linker Split - I have to disagree. There must be way to have a better rvmat code for the grass clutters. The one you referred will be similar to case 3 and 4. With the observation: "No Bug but the color and ending are very hard and rude.

@Synide - Your code will also be similar to case 3 and 4. With the observation: "No Bug but the color and ending are very hard and rude.

Now i ask this: Is there something we need to do in the clutter models that we have not done yet and need to do?

edit: Or maybe all clutters (rocks, bush, grass, etc) must have the exact following codes in order to make it work without bugs and issues and having the best visual feeling we can get:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">PixelShaderID = "Normal";

VertexShaderID = "Basic";

renderFlags[] = {"AlphaInstancing", "NoZWrite"};

Share this post


Link to post
Share on other sites

Maybe try with .5, moving the back facing polys into a different section, forcing each instace to load the material twice, and you might get the same result as you would when you see 2 different instances of grass blending together with no transparent bug, would double the vert count and draw calls so might take a slight performance hit, but they're still instances so could be worth a shot.

Share this post


Link to post
Share on other sites
@Synide - Your code will also be similar to case 3 and 4. With the observation: "No Bug but the color and ending are very hard and rude.

So you actually tried it and it doesn't do it for ya eh? that's cool...

The only other suggestion I can make apart from trying to setup a 2 stage material situation (like glass) is that you edit the alpha channel of the texture in Photoshop to something like... coupled with that above .rvmat I posted...

alpha.png

regarding your suggestion about rocks & clutters... not a good idea imo.

oh btw, once again I'll say 'AlphaInstancing' does not appear to be a vaild renderflag with this version of binarize.exe.

Share this post


Link to post
Share on other sites
The only other suggestion I can make apart from trying to setup a 2 stage material situation (like glass) is that you edit the alpha channel of the texture in Photoshop to something like... coupled with that above .rvmat I posted...

[im]http://i198.photobucket.com/albums/aa15/sbeetham/alpha.png[/img]

ok, i would like to try it but I'm no expert in photoshop and i don't know how to do it, can you please teach me how i can add that effect to the Alpha 1 channel please?

regarding your suggestion about rocks & clutters... not a good idea imo.

I tried to use the same .rvmat for rocks clutter but it did not solve the problem as expected.

oh btw, once again I'll say 'AlphaInstancing' does not appear to be a vaild renderflag with this version of binarize.exe.

what do you mean with this "with this version of binarize.exe."?

I don't understand what you trying to say..

edit: typo

Share this post


Link to post
Share on other sites

nope there's not a better way... I tell you cause I worked a looooot for my HDT island which involves a lot of grass and plantsa, and I optimized everything, tried everything, but still no result... if you want smooth textures, then performance will be less improved, while using the rude option (3-4) will improve performance...

There's no way to have smooth textures without the alpha problem..

maybe try alphatest256.

Yeah Synde is right, seems that binarize doesnt recognize Alphainstancing flag, and doesn't process it...

Share this post


Link to post
Share on other sites
ok, i would like to try it but I'm no expert in photoshop and i don't know how to do it, can you please teach me how i can add that effect to the Alpha 1 channel please?

lol, although it takes about 32 1/3 seconds to do... it takes a lot longer to explain it...

Check with Mikebart if he is happy with you to modify his texture.

The short version is...

open the .tga version of the texture.

in the layers tab make 2 new layers. in layer one flood it with 128,128,128, in layer 2 (the top most) flood it with 0,0,0.

switch to the channels tab. hold ctrl key down and left-click on the little picture of the alpha channel. this will select all the 'white' in the channel.

switch back to the layers tab. left-click on the fully black layer (layer 2). Goto the photoshop menu 'Select>Modify>Expand' and enter 5 pixels. This expands the current selection by 5 pixels in every direction.

Hit ctrl-x to cut out this selection in the black layer.

Go back to the channels tab. Again, hold ctrl and left-click on the little picture of the alpha channel. This creates the same selection of the white in the alpha as earlier.

Swap back to the Layers tab. Left-click in the 'Grey' layer (layer 1).

Goto 'Select>Modify>Contract' and enter 1 pixel. This reduces the current selection by 1 pixel in every direction.

Hit ctrl-x while still in the 'Grey' layer to cut out the reduced selection.

Highlight both the black and the grey layers. Right-click the layers in the layers tab and select 'Merge Layers' from the context menu.

Hit Ctrl-A to select the entirety of this newly merged layer and to Ctrl-X to cut it.

Swap to the Channels tab and make a new Alpha channel. Ctrl-V to paste this clipboard saved layer into this new Alpha Channel.

Delete the old alpha channel. Delete the empty Layer you cut it from in the Layers Tab.

Save the whole lot back out to disk. Convert the .tga to .paa.

Give it a crack jack.

Regarding, 'AlphaInstancing'. It's not a renderFlag, simple.

Essentially, what you are trying to do is make the alpha a little fuzzy around the edges. So, you might have to play around a bit with the selection sizes etc....

Whether this combined with a resonable .rvmat gets you your desired result only you can say... good luck.

Share this post


Link to post
Share on other sites

Thanks for the explanation, ill give it a try.

By the way, im not editing Mikebart's textures.

I'm editing my own creations and BIS's.

Share this post


Link to post
Share on other sites

@Synide i have not tested what you mentioned yet, but i intend to.

There is just one thing that still confuses me:

I have a clutter with only 2 faces, creating and simulating a desert bush and this one does not visually have the issue referred on the thread. Ie, while using the rvmat in case 1 the rocks in 2nd plan do not appear in 1st plan. See what i mean in the following pictures:

Ingame Picture 1 , Ingame Picture 2

Does anyone have a reason for this happening?

edit: Thats why i still believe there must be a way of having a better visual quality for grass using case 1.

Share this post


Link to post
Share on other sites
Does anyone have a reason for this happening?

renderFlag="NoZWrite";

With this flag set it means that the faces this material is attached to will not be used in the calcs. for z-ordering.

Without 'NoZWrite' on Grass.

You

|

|

|

Grass

|

|

|

Rock

With 'NoZWrite' on Grass.

You

|

|

|

Rock

|

|

|

Everything Else

|

|

|

Grass

Get it?

Share this post


Link to post
Share on other sites

Not completely sure but i think i know what you are trying to say.

Though why does this happen when the following code is used:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">mainLight = "Sun";

fogMode = "Alpha";

ambient[] = {2, 2, 2, 1.0};

diffuse[] = {2, 2, 2, 1.0};

forcedDiffuse[] = {0.0, 0.0, 0.0, 1.0};

emmisive[] = {0.0, 0.0, 0.0, 1.0};

specular[] = {0.0, 0.0, 0.0, 1.0};

specularPower = 1.0;

PixelShaderID = "NormalMapGrass";

VertexShaderID = "Basic";

renderFlags[] = {"NoZWrite"};

As you can see I'm trying not to use the "PixelShaderID = "Grass";" because the option "Grass" is killing completely the full potential of a texture.

In the above picture, the first bush does not let pass other clutters to 1st plan, this is a model with only 2 faces in X style.

Share this post


Link to post
Share on other sites

lol, i appreciate what your trying to do but you have to remember that there are a number of variables at play here... the textures, the model, the scene management, your current game settings to go through each .rvmat setting with you on a forum like this is completely just too hard... especially when you keep moving the goal posts... now your showing me a picture that exhibits certain traits and your showing me an .rvmat with a PixelShader of 'NormalMapGrass'... I mean really Bravo6... the normal map grass shader requires that you have a stage with a normal map specified at least...

Do not use 'NoZWrite' !

Now your over saturating the ambient & diffuse...

Look, with the previously mentioned .rvmat...

eg.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

ambient[]={0.4,0.4,0.4,1};

diffuse[]={0.4,0.4,0.4,1};

forcedDiffuse[]={0,0,0,1};

emmisive[]={0,0,0,1};

specular[]={0,0,0,1};

specularPower=1;

PixelShaderID="Grass";

VertexShaderID="Basic";

mainLight="Sun";

fogMode="Fog";

renderFlags[]={"AddBlend","AlphaTest64"};

and a slightly blurry edge around the outside of the plant and with anti-aliasing and other graphics settings at appropriate levels then I don't get this '...color and ending are very hard and rude.'

You can use a PixelShader like 'NormalMapGrass' but you should specify the rest of the .rvmat else it's pointless...

As for your latest picture, it really could be a combination of the fact your using 'NoZWrite', PS of 'NormalMapGrass' without all the req'd info, your oversaturation of the ambient & diffuse along with whatever settings you have setup for your rocks...

So, it's pretty hard to tell exactly why that picture is the way it is...

Harking back to your original 1st post.

The ONLY 2 .rvmats you should be considering as starting points are 3 & 4. ALL the others are incorrect to use for one reason or another.

You need to start at a know point where everything is working.

That point in this case is the above .rvmat. And, do a slightly blurry edged texture and set your graphic settings appropriately.

Then, once you have done that then you can do some more pictures of what it looks like...

Sorry if I sound a bit tired... this area of modding has quite a number of variable components to it and very hard to get across info. through a forum medium.

Share this post


Link to post
Share on other sites

hey guys, heres a more alphatesting freindly version of the grass texture: GrassAlphaTest

Im using the "3 - BIS original rvmat" with this and I cant see any visual difference between alphatest 32,64,128, i mean im not getting different amounts of cut out, like i imagined I would.

Share this post


Link to post
Share on other sites
hey guys, heres a more alphatesting freindly version of the grass texture: GrassAlphaTest

Im using the "3 - BIS original rvmat" with this and I cant see any visual difference between alphatest 32,64,128, i mean im not getting different amounts of cut out, like i imagined I would.

well not much difference to the eye, but to the engine yes.

Using 32 instead of 256 for example improves performance a lot wink_o.gif

cause it uses less pixels

Share this post


Link to post
Share on other sites

This is quite different to any kind of alphatesting as I know it, what sort of a situation would one use alphatest256?

Share this post


Link to post
Share on other sites

I said 256 to create a range.. but I use alphatest64 for my HDT plants and grass

Anyway, the RVMAT Synde posted is the only one (along with mine) that best suits grass clutters

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  

×