lighting both side of triangle
-
Alucard344
- Posts: 21
- Joined: Wed May 20, 2009 8:17 pm
- Location: Qc, Canada
lighting both side of triangle
As the title says, i need to light both side of my mesh. this is because i have clipping plane and when a mesh is cut, i don't want to see the interior of the mesh black.
The only way i see to do that would be to duplicate the mesh with the invert normal. but that would lower the performance.
What would be the best way to achieve that ? Does Irrlicht provide any function or material to help on that ?
Thanks
The only way i see to do that would be to duplicate the mesh with the invert normal. but that would lower the performance.
What would be the best way to achieve that ? Does Irrlicht provide any function or material to help on that ?
Thanks
i don't know about any native irrlicht method of doing it, but in a HLSL shader
you can pass
to the pixel shader, you can then use it in the pixel shader to modulate the normal for example. IIRC its only available to pixelshader 2 or greater.
for GLSL you would check
in the fragment
you can pass
Code: Select all
float backfacing : VFACE;for GLSL you would check
Code: Select all
gl_FrontFacing-
Alucard344
- Posts: 21
- Joined: Wed May 20, 2009 8:17 pm
- Location: Qc, Canada
is that strictly true ? maybe some initial hit if creating the geometry on the fly and some impact from the scene manager having to handle another object but I can't see the drawing performance being much different for a 2 sided material or a 2 sided mesh. Suppose it costs double the verts, which should be quite cheap depending on the complexity of the mesh.The only way i see to do that would be to duplicate the mesh with the invert normal. but that would lower the performance.
-
Alucard344
- Posts: 21
- Joined: Wed May 20, 2009 8:17 pm
- Location: Qc, Canada
The fastest and the simplest way is to use shaders
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
-
Lonesome Ducky
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
http://irrlicht.sourceforge.net/phpBB2/ ... 206#238206hybrid wrote:For OpenGL we could add two-sided lighting. But IIRC D3D does not offer this?!
Yes please
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
Height2Normal v. 2.1 - convert height maps to normal maps
Step back! I have a void pointer, and I'm not afraid to use it!
-
Alucard344
- Posts: 21
- Joined: Wed May 20, 2009 8:17 pm
- Location: Qc, Canada