Horde3D http://horde3d.org/forums/ |
|
Handling back face and front face culling http://horde3d.org/forums/viewtopic.php?f=1&t=571 |
Page 1 of 1 |
Author: | Mikmacer [ 01.12.2008, 20:35 ] |
Post subject: | Handling back face and front face culling |
Is there a good way to handle back face and front face culling within Horde3D? The only way I know is to directly set this option with OpenGL, but I think that a flag within the pipeline xml file would be great. My problem is that I need to render the front face and the back face in two different buffers to calculate some effects, and I can't really switch between back face and front face culling in the pipeline. I could switch off this culling and check within GLSL if its the back face or the front face, but I don't want to add a condition at the beginning of each shaders. |
Author: | marciano [ 02.12.2008, 01:25 ] |
Post subject: | Re: Handling back face and front face culling |
Unfortunately, at the moment, there is no other way than the shader method you mentioned. But we will certainly add some way to configure the backface culling for 1.0. |
Author: | anchor [ 11.11.2010, 13:23 ] |
Post subject: | Re: Handling back face and front face culling |
Hello! Is there a way now to configure the two-sided faces? |
Author: | swiftcoder [ 11.11.2010, 16:14 ] |
Post subject: | Re: Handling back face and front face culling |
Mikmacer wrote: I could switch off this culling and check within GLSL if its the back face or the front face, but I don't want to add a condition at the beginning of each shaders. A small variation on this is the recommended way to accomplish this, last I checked.Attach *both* target buffers via MRT, and check the value of gl_FrontFacing to decide which buffer to send this fragment to. Even though it adds a branch to your shader, modern GPUs are much better at branching, and you only use one pass, rather than two. |
Author: | worstplayer [ 11.11.2010, 16:18 ] |
Post subject: | Re: Handling back face and front face culling |
anchor wrote: Hello! CullMode=None
Is there a way now to configure the two-sided faces? |
Author: | DarkAngel [ 12.11.2010, 09:56 ] |
Post subject: | Re: Handling back face and front face culling |
Also, with two-sided faces, you must modify the shader so that lighting is computed correctly. After the line where the normal is computed (e.g. "vec3 normal = ..."), add in: normal *= gl_FrontFacing ? 1.0 : -1.0; |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |