Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 5th March 2006, 01:18 PM   #1
rogerjames99
Junior Member
Junior member
 
Join Date: Mar 2006
Posts: 2
Default OpenGL two sided lighting model

I am hacking the AC3D loader for OpenSceneGraph again. One thing I am thinking of doing is enabling two sided lighting for two sided surfaces.

I recommend AC3D as my modeller of choice to all our users. But I get grief from them about black surfaces. I am getting tired of telling them to make all surfaces one sided and then flip them the right way round! (By the way - a preference setting for one sided surfaces as default would be nice!)

So, is two sided lighting for two sided surfaces the correct behaviour for AC3D loaders in the OpenGL world?

It looks like the 3d display in AC3D itself does this. However all of the examples for parsing the AC3D file format only use the two sided flag to control back face culling.

Any guidance gratefully received!

Roger
rogerjames99 is offline   Reply With Quote
Old 5th March 2006, 03:24 PM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default

> But I get grief from them about black surfaces. I am getting tired of telling them to make all surfaces one sided and then flip them the right way round!

Get them to show normals and check that they are all facing how they want them. Press 'n' to show-normals. Reverse normals with Surface->flip-normal.

Black surfaces may be due to polygons not being handled by the other code (the sample AC3D loader won't handle them). AC3D internally supports concave polygons (e.g. a single polygon 'C' shape) which is a bit more involved to code.

In AC3D, objects that don't need to have two-sided surfaces are set to single sided e.g. spheres. single surfaces and 2d shapes have two-sided by default. I don't feel a global setting makes sense here but as always, we are open to ideas.

The attribute for 1S/2s is set in .ac files in the surface flag.
Andy is offline   Reply With Quote
Old 5th March 2006, 09:38 PM   #3
rogerjames99
Junior Member
Junior member
 
Join Date: Mar 2006
Posts: 2
Default

Andy,

Thanks for the quick response. But I think you misunderstood what I was asking. I probably was not precise enough in my question.

Your sample code for the parsing the ac3d file format and rendering in OpenGL always uses one sided lighting. Therefore when models are directionally lit one side of a two sided surface looks dark, even though in the 3d display in ac3d it is rendered lit.

My question is -

Should 2 sided surfaces imported from ac3d files and rendered in OpenGL have the OpenGL 2 sided lighting attribute set on them.

I know this may appear obvious, but I just want to check before I turn it on because it will cause a big performance hit.
rogerjames99 is offline   Reply With Quote
Old 6th March 2006, 04:06 AM   #4
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default

My apologies, Yes, you should use two-sided lighting and cull backfaces for single sided surfaces.

Andy
Andy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 09:56 AM.


AC3D Forum
(C) Inivis Limited 2020