Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Models Normals flattened when sent to shader

Author
Message
Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 15th Jun 2009 06:43
Okay so i've been programming shaders lately, and implementing them into the gdk, without any of those disappearing problems (which i've seen are mostly caused by human error), but i have another problem instead. When i apply the shader along with the required textures, and set the shader data, it works perfectly, however if i load a .x mesh and apply the shader to it with the same textures and data, it seems to wipe the normals and makes my model faceted before applying the effects.

Here is a shot with the shader applied along with the textures:


It's hard to tell on this model, so i tried again with a white texture and a flat normal map to better demonstrate:


When i render it normally, without the shader, the model is perfectly smooth, just like it should be. Is this a problem with my shader or inherent in the gdk? i can post the shader later if need be.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 15th Jun 2009 14:09
You may want to try the solution that appears here, and tell us how it goes:

http://forum.thegamecreators.com/?m=forum_view&t=151516&b=1

Basically, to load the object in and 3d modeling tool, and then re-export the object checking that there is no smoothing on the normals.

Quote: "When i render it normally, without the shader, the model is perfectly smooth, just like it should be. Is this a problem with my shader or inherent in the gdk? "

It is true that this issue doesn't appear until you set a shader on the object. But I've tried with the internal 'make' objects, and the seam doesn't show, so I don't know if the error lies on our meshes or in the DGDK mesh loading somewhere...
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 15th Jun 2009 14:26
I would guess that your normals are getting messed up somehow, when applying the shader, whether or not it is caused by shader application, or a GDK nuance, wouldnt a solution be to just recalculate them ?

GDK has an inbuilt function to recalc the normals, void dbSetObjectNormals(int objID); not sure how well it works though.

However, knowing exactly what is the cause would be nice, so maybe you could try applying a different shader, of the same/similar type/effect, but written by someone else, that you know works on other pc's and see if it messes your normals, if it doesnt, then i'd say your shader is the culprit.

Good Luck

If it ain't broke.... DONT FIX IT !!!
Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 15th Jun 2009 22:00
Okay so i found a way to fix the problem what i do is load it up in fragmotion then weld all the verts and export it to .x once again. Blender's .x export scripts are very unreliable but i finally managed to get it working.

Login to post a reply

Server time is: 2024-11-05 23:14:11
Your offset time is: 2024-11-05 23:14:11