Lighting quality on Obj models

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Lighting quality on Obj models

Post by robmar »

Is it possible to set the smoothing angle for materials so that the light reflections are less triangulated?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Lighting quality on Obj models

Post by mongoose7 »

Well, the normals are under your control. To get sharp edges, you would have needed to duplicate the vertices? So now you should average the normals at each vertex.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

Okay, the problem is that the light reflections are angular and match up to the triangles in the model.

I don´t want to increase the number of triangles in the model, but have the lighting smoothed across the surface.

Would that be best done programmatically, or via settings in the materials or model?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Lighting quality on Obj models

Post by hendu »

You need a shader to get per-pixel lighting. But your normals also need to be good for that to work.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

Okay thanks! Is there an example of a per-pixel shader for Irrlich? You mean the normals in the model have to be good?
XenoZergNid
Posts: 17
Joined: Sun Oct 13, 2013 1:52 am

Re: Lighting quality on Obj models

Post by XenoZergNid »

I havn't done it before but:
http://irrlicht.sourceforge.net/docu/example011.html
seems to be what your looking for.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

Thanks, but that example is for bumping I think...
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

I guess I should try the per pixel shader in XEffects, that should do it!
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

Seems there is no pixel shader in Xeffects 1.3, at least I can´t find it.

The problem I have with Irrlicht´s default shader is the jagged edges of the light-to-shadow at the boundary region of the light.

This is noticeable on circling lights, where the range of the light does not quite cover the entire model.

Otherwise the lighting looks good and smooth, the problem is the light boundary area.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Lighting quality on Obj models

Post by mongoose7 »

The XEffects shaders are in the .cpp file.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

I´ll take a look, cheers! Just saw that there are some in the Shaders folder too.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

XEffects draws everything to a texture that it then displays across the screen on a quad, that´s going to hit the FTP for complex scenes.

I guess Irrlicht just needs a good multi-lightsource per pixel shader but then that won´t manage shadows... without some complication.

Image here: http://www.sendspace.com/file/wuc2y3 (tried to post this as an image... is there a place images can be posted?)

This image shows what happens when a light with radius smaller than the model, crosses over the model, the extremity of the light is not a continuous line, but follows the borders of the mesh triangles, so I guess that's vertex lighting, would that be right?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Lighting quality on Obj models

Post by hendu »

Yes, that is vertex lighting.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Lighting quality on Obj models

Post by robmar »

Yes, but also I´m getting the effect shown on this web page, which they say is due to bad normals! http://gamedev.stackexchange.com/questi ... ng-problem
Klunk
Posts: 264
Joined: Mon Jan 10, 2011 5:21 pm

Re: Lighting quality on Obj models

Post by Klunk »

what are you using to create the models ? as i don't think its bad normals as such....

Image

in the two models above the normals are handled "differently". In the right hand model there 3 separate vertices for each corner each vertex has the same position but a different normal. Where as the the left hand model has one vertex per corner with one normal as the average of the three normals in the right hand model. These models were created in 3ds max and max uses something called smoothing groups to vary how object are smoothed. Faces with Different smoothing groups will give hard edges, faces with the same smoothing groups will be smoothed across the edge by sharing normals. In addition the exporter you use has to be clever enough to create the model in such a way to work correctly in an engine such as irrlicht.
Post Reply