Horde3D

Next-Generation Graphics Engine
It is currently 19.04.2024, 02:31

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 01.12.2008, 20:35 
Offline

Joined: 16.01.2008, 00:24
Posts: 73
Location: Canada/Quebec
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.


Top
 Profile  
Reply with quote  
PostPosted: 02.12.2008, 01:25 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
PostPosted: 11.11.2010, 13:23 
Offline

Joined: 29.10.2010, 14:28
Posts: 46
Location: Hungary
Hello!

Is there a way now to configure the two-sided faces?


Top
 Profile  
Reply with quote  
PostPosted: 11.11.2010, 16:14 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
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.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 11.11.2010, 16:18 
Offline

Joined: 08.06.2010, 14:17
Posts: 63
anchor wrote:
Hello!

Is there a way now to configure the two-sided faces?
CullMode=None


Top
 Profile  
Reply with quote  
PostPosted: 12.11.2010, 09:56 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
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;


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group