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 / [GDK2.0] Object not lighting

Author
Message
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2012 00:52 Edited at: 13th Jul 2012 00:53
I am having a problem with an object not lighting properly.

The red object in the center of the screen is actually 2 objects. They are single-limbed and they are lit properly. The cave they are in is not (it has multiple limbs). The light is light0 (directional) and I colored it red so I could see any lit areas apart from the ambient.
I have tried all the normal ideas for making sure the lighting is correct, but I think there is something else wrong. Here is the appropriate code:

As you can see, I tried everything (that I can think of) and nothing works correctly. The only thing that seems to make any difference is the scaling down of the object. Even that doesn't make the lighting work the way it's supposed to. I think it might be a limb issue. I have the level broken into limbs and there is one part of it that seems to work, so it could be limb related..... How would I fix it if that's the case?

The fastest code is the code never written.

Attachments

Login to view attachments
Andrew_Neale
10
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 13th Jul 2012 01:01 Edited at: 13th Jul 2012 01:03
Have you made sure the object's normals are set correctly? I believe there is a 'dbSetObjectNormals(id)' command you could try. Also, if the object is scaled the normals may not have scaled correctly with it so try 'dbSetNormalizationOn' as well. I'm afraid as I only use Dark BASIC Professional and only just started Dark GDK 2 these command names are educated guesses but hopefully they're close if not exact.

[Edit] Just took a look and they're both correct. [/Edit]


Previously TEH_CODERER.
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 13th Jul 2012 01:06
dbSetNormalizationOn(); That did the trick! Why is that not the "normal" mode? I tried dbSetObjectNormals(id) earlier, but did nothing. Thanks for the tip.

The fastest code is the code never written.
Andrew_Neale
10
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 13th Jul 2012 01:17
It does seem odd that it doesn't default to that. The set object normals command would only have an effect if the object didn't already have the correct normals generated which yours clearly did, they just weren't scaled correctly. Either way, I'm glad you've got it working now.


Previously TEH_CODERER.

Login to post a reply

Server time is: 2020-02-16 21:46:23
Your offset time is: 2020-02-16 21:46:23