Sign in to follow this  
db123

how to render a two-sided mesh with correct illumination

Recommended Posts

db123    222
I can render two-sided mesh by set the cullmode to CULL_None, but when i illuminate it by a spot light, there is some black place where the back-face is.
[img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]
this is a screenshot with enable cull.
[attachment=7459:1.png]

the following screenshot with disable cull. the white sign is the back face of this mesh.
[attachment=7460:2.png]

I think the normal sampled from normal map is the normal for that pixel's reverse side, so my light can't illuminate it.

I wan't to know how to render the two-sided mesh with correct illumination, or get the correct normal for that pixel. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]


this is the mesh:
[attachment=7461:3.png]
[img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]

Share this post


Link to post
Share on other sites
Hodgman    51223
Which graphics API/shader language are you using?

Depending on the shader language, you can use gl_FrontFacing, VFACE or SV_IsFrontFace to tell you if the current pixel belongs to a front-face or a back-face. If you're shading a back-face, you can flip the normal.

Share this post


Link to post
Share on other sites
db123    222
[quote name='Hodgman' timestamp='1330239338' post='4916677']
Which graphics API/shader language are you using?

Depending on the shader language, you can use gl_FrontFacing, VFACE or SV_IsFrontFace to tell you if the current pixel belongs to a front-face or a back-face. If you're shading a back-face, you can flip the normal.
[/quote]

thank you, i use directx 11.[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
db123    222
[quote name='Hodgman' timestamp='1330239338' post='4916677']
Which graphics API/shader language are you using?

Depending on the shader language, you can use gl_FrontFacing, VFACE or SV_IsFrontFace to tell you if the current pixel belongs to a front-face or a back-face. If you're shading a back-face, you can flip the normal.
[/quote]
it works well, thank you ~!![img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this