Lighting issues with Grass Models
by Matthew Genge · in General Discussion · 06/30/2013 (1:22 pm) · 25 replies
I've just released a new version (1.19) of Forester Pro, a 3D tree creator for Torque3D, which can now create grass and small plants. Forester Pro creates grass and small plants as clusters of meshes giving them volume compared with billboard grass, however, there is an issue with these meshes. The reversed shadowed face of meshes are too dark. Below is an image of the grass illustrating the issue (this is the same models in Unreal Engine 3).

This image also shows acacia, thorn bush and knob thorn models from our Africa tree template pack (each template can be used to generate a wide range of different trees.
The issue in UDK isn't too bad, however, you can see the slightly too dark back faces. In UDK I can use a material shader to change this, but is there a way in Torque3D? In the material editor I can't see any options to change the appearance.
Anyway, if you want to check out Forester Pro there is a free version available for download, and the registered version is only $20. The models produced by Forester Pro include collision meshes and vertex colours for wind effects and import seamlessly into the world editor.
www.hptware.co.uk/forester.htm

This image also shows acacia, thorn bush and knob thorn models from our Africa tree template pack (each template can be used to generate a wide range of different trees.
The issue in UDK isn't too bad, however, you can see the slightly too dark back faces. In UDK I can use a material shader to change this, but is there a way in Torque3D? In the material editor I can't see any options to change the appearance.
Anyway, if you want to check out Forester Pro there is a free version available for download, and the registered version is only $20. The models produced by Forester Pro include collision meshes and vertex colours for wind effects and import seamlessly into the world editor.
www.hptware.co.uk/forester.htm
About the author
I am an Earth Scientist who likes writing games for fun.
#2
Does it add another plane? Or is it a double-sided shader? I've just looked in the editor and I noticed it seems to show the backface but with the same normals as the reverse. I've done this myself when writing shaders since it is considerably faster than duplicating and reversing the normals.
Luckily Forester can produce double sided meshes with reversed normals. I'll see if this works better.
Many thanks,
Matt
06/30/2013 (2:37 pm)
Hi Steve,Does it add another plane? Or is it a double-sided shader? I've just looked in the editor and I noticed it seems to show the backface but with the same normals as the reverse. I've done this myself when writing shaders since it is considerably faster than duplicating and reversing the normals.
Luckily Forester can produce double sided meshes with reversed normals. I'll see if this works better.
Many thanks,
Matt
#3
Unfortunately I have just noticed I have disabled double-sided meshes for Torque3D in Forester Pro. I will have to re-enable it in the next update. Why is the work never done, and the rum is always gone.
06/30/2013 (2:49 pm)
Yes, I think this is the reason. It looks like the double-sided option simply sets backface culling to off in the shader rather than creating a duplicate of the face with reversed normals.Unfortunately I have just noticed I have disabled double-sided meshes for Torque3D in Forester Pro. I will have to re-enable it in the next update. Why is the work never done, and the rum is always gone.
#4
If you've already installed Forester Pro you can get an updater here:
www.hptware.co.uk/downloads/foresterupdate120.zip
You can also download a free version of Forester from our website featuring 7 free tree types.
www.hptware.co.uk/forester.htm
There is now a double-sided option in the exporter for T3D Collada models. These double-sided meshes can be used the same as other foliage objects, simply turn off double-sided in the T3D material editor.
07/09/2013 (7:41 am)
Ok...so I have updated Forester Pro to generate double-sided meshes which improves the appearance of volumetric grass and small plant models produced by Forester. It also seems to give a performance increase since the back faces no longer need to be rendered by the shader.If you've already installed Forester Pro you can get an updater here:
www.hptware.co.uk/downloads/foresterupdate120.zip
You can also download a free version of Forester from our website featuring 7 free tree types.
www.hptware.co.uk/forester.htm
There is now a double-sided option in the exporter for T3D Collada models. These double-sided meshes can be used the same as other foliage objects, simply turn off double-sided in the T3D material editor.
#5
I love this product - when I near "beta" for my project I intend to use it to add awesomeness to my scenery. Keep up the good work!
07/09/2013 (9:03 am)
The rum is always gone because the work is never done....I love this product - when I near "beta" for my project I intend to use it to add awesomeness to my scenery. Keep up the good work!
#6
07/09/2013 (9:04 am)
What is a double sided mesh? Never heard that before, maybe this is a solution for the lighting problem, because that is not just with grass, but with all backface meshes.
#7
Shaders can generate double-sided planes by disabling backface culling, but this doesn't reverse the normals of the face and so they aren't lit properly. Proper double-sided faces can be generated with shaders but reversing the normals is quite computationally intensive. Although a double-sided mesh doubles polycount they often have better performance.
07/09/2013 (10:02 am)
It's simply a plane with two sides, so it has double the number of faces. Back faces share vertices but have different winding orders and opposite normals.Shaders can generate double-sided planes by disabling backface culling, but this doesn't reverse the normals of the face and so they aren't lit properly. Proper double-sided faces can be generated with shaders but reversing the normals is quite computationally intensive. Although a double-sided mesh doubles polycount they often have better performance.
#8
07/09/2013 (10:14 am)
Thanks for this solution, this explains many problems...
#9
07/09/2013 (2:41 pm)
Ah, so even the old ground cover could benefit from this.
#10
07/09/2013 (2:47 pm)
But maybe this could have been solved from the engine code side also, because the engine does nothing else than duplicating the meshes, but in this case with wrong normals.
#11
I expect that the double-sided property in T3D is a shader, if so it doesn't generate a mesh, it simply turns off back face culling. Shaders can be quite slow. You'll notice in Forester that it runs a lot better with shaders turned off.
07/09/2013 (2:58 pm)
I thought the old ground cover is billboards? If so these are always pointing at the camera and so are one-sided.I expect that the double-sided property in T3D is a shader, if so it doesn't generate a mesh, it simply turns off back face culling. Shaders can be quite slow. You'll notice in Forester that it runs a lot better with shaders turned off.
#12
07/09/2013 (4:00 pm)
Ground Cover generates a second mesh if you turn backface on, you can see it in the increase of grass bunches and so one faces with the normal towards you and one with the normal away from you.
#13
In an HLSL shader, double-sided faces can most easily be generated by:
07/09/2013 (4:21 pm)
I think that the shader is just rendering the backface. T3D isn't generating duplicated meshes. Without double-sided set on in the material editor backfaces aren't drawn so any face pointing away from the camera (defined by its winding order) is invisible. When double-sided is set in the material properties these backfaces are rendered meaning you can see them. However, the lighting is determined by their normals which are pointing away from the camera. This is the behaviour you'd expect from a shader effect.In an HLSL shader, double-sided faces can most easily be generated by:
technique Diffuse
{
pass Pass1
{
AlphaBlendEnable = TRUE;
CullMode = None; //This means render backfaces
DestBlend = INVSRCALPHA;
SrcBlend = SrcAlpha;
VertexShader = compile vs_1_1 VertexShaderFunction();
PixelShader = compile ps_1_1 PixelShaderFunction();
}
}
#14
07/09/2013 (5:30 pm)
A engine solution maybe would be better, otherwise you would have to tell all people that they have to rebuild all models to work better, because Torque has problems with that.
#15
R
07/09/2013 (6:36 pm)
No offense Duion but, that idea creates lazy artists. I don't know of a single game engine out today that does not require the artist to design in a 'specific' way. This is not a bad thing. It's things like this that separate the 'pro' from the guy that is 'familiar' with the engine. R
#16
tbh it looks better with double faces
there is nothing lazy about expecting/ to have
a engine solution but that isn`t going to happen
at least not that soon.
so ppl who want better lit grass/ trees
should change their meshes to use double faces
07/10/2013 (3:15 am)
Did yesterday some teststbh it looks better with double faces
there is nothing lazy about expecting/ to have
a engine solution but that isn`t going to happen
at least not that soon.
so ppl who want better lit grass/ trees
should change their meshes to use double faces
#17
The double-sided option in T3D export from Forester just generates extra faces for leaves, not for the branch/trunk mesh. I must see if I can benchmark the influence this has on fps for both grass and tree models. It would be good to have some quantitative numbers rather than a qualitative impression. Will do this to guide optimization of Forester.
07/10/2013 (4:18 am)
There is a limit to what you can expect the engine to do for you. Duplicating meshes and reversing any single-sided plane is entirely possible during import of a collada, but it could cause artifacts. It is easy just to duplicate faces in the mesh, swap the winding order of verts on the face, and generate reversed normals. However, on more complex models, such as trees, you'd only want to do the leaves, you wouldn't do the trunk since inwards pointing faces wouldn't be any use. Easier to ensure the model is designed to be optimised.The double-sided option in T3D export from Forester just generates extra faces for leaves, not for the branch/trunk mesh. I must see if I can benchmark the influence this has on fps for both grass and tree models. It would be good to have some quantitative numbers rather than a qualitative impression. Will do this to guide optimization of Forester.
#18
07/10/2013 (8:42 am)
I don't know - I'd like the engine to take my lousy, lame looking models and make them look freakin' awesome on import. I worked my butt off to make those but they still look terrible....
#19
07/10/2013 (9:18 am)
Well said Richard ;)
#20
07/10/2013 (10:36 am)
There are in fact some special effects engine wise that can almost everything make look good in some way.
Associate Steve Acaster
[YorkshireRifles.com]
If you're not using "double-sided" on the material then disregard ...