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.

Author
Message
adamika2000
16
Years of Service
User Offline
Joined: 30th Jun 2010
Location: Hungary
Posted: 19th Jul 2011 20:40
I made a 3D model, and I would like to use it in my DBPro project.
After I loaded it, I see the model, but it is very dark. I attached the source, and the model. I dont know, what is the problem

code:
load object "death_glider.x",1

scale object 1,10,10,10

position camera 0,10,-20

hide light 0

make light 1
show light 1
position light 1,0,0,-20

Sync On
Sync Rate 60

do

control camera using arrowkeys 0,1,1

sync
loop
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jul 2011 01:03
add this line of code



Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2011 02:49
No. The problem is that the object doesn't have normals, or more correctly they have all been set to zero, so all you are seeing is the ambient light. Make sure it is exported from your modelling program with normals correctly calculated.

You could try adding the following line after loading the object:



That will compute the normals for you using default DBPro assumptions about the model (whatever they are).
adamika2000
16
Years of Service
User Offline
Joined: 30th Jun 2010
Location: Hungary
Posted: 20th Jul 2011 11:32 Edited at: 20th Jul 2011 12:08
Thx! It's better than last time, but where the object should be lighter, it's white



image:

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2011 12:30 Edited at: 20th Jul 2011 12:45
I see what you mean.

That problem seems to be caused by the object's specular reflection which may have been set too bright. Add this command after setting the normals and experiment with the colour values. I've used rgb(0,0,0) which turns off the specular reflection, i.e. the reflected light is black and has no effect.

Actually, I've just done some tests and that command doesn't behave as I would expect on your model. It's behaving as if it's an all or nothing effect which isn't correct. For example using rgb(255,0,0), i.e. reflected light is bright red, looks very similar to using rgb(1,0,0), i.e. very dark red. This may be a DBPro bug - but on the other hand I've never encountered this problem on other objects so perhaps something is set wrong in your model. I'll try to find time to investigate and report back.

Edit Just done some tests with DBPro spheres and I get the same problem - but only if the object is scaled. I think this problem was reported by Scraggle some time back and it sounds as if it wasn't resolved. Something obviously goes wrong with the scaling. So the problem is not your code. Can you get a scaled version of your model so you don't need to scale it in DBPro? Your model looks OK (apart from the faceting) when it isn't scaled:

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jul 2011 12:50
Quote: "but on the other hand I've never encountered this problem on other objects so perhaps something is set wrong in your model"


Yeah! Time ago I saw something like that with an exporter for 3DMax...the Quest3d_exporter (good engine for games) ...the behavior of the brightness of the light was very strange .Into Dbpro when the light was on the right, the object was illuminated on the left.

That`s why I made it easy ...just seting object emissive...but that is not good in all situation .

Cheers.

I'm not a grumpy grandpa
adamika2000
16
Years of Service
User Offline
Joined: 30th Jun 2010
Location: Hungary
Posted: 20th Jul 2011 12:54
thank you

without scaling it works perfectly
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2011 15:06 Edited at: 20th Jul 2011 15:06
You're welcome.

If you need scaling you could use this. It works as DBPro scaling should work - but without the bug. I hope the code is self-explanatory. If not just ask. But I won't be around till later.

Math89
22
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 20th Jul 2011 21:16
If I remember correctly, there is a command for that: Set Normalization On (or something close). The problem is just that the scaling also affects the normals, which are no longer unit-length, and will mess up the lighting calculations.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jul 2011 22:28
That's what I thought but recalculating the normals doesn't fix the problem so the scaling has probably been misapplied in the regular DBPro command.

Your suggestion about using set normalization on rings a bell but even if it works it sounds like a hack - it's better to get the object's data correctly calculated in the first case. Object scaling isn't rocket science - although the function I posted might not work for all objects such as those with animation.

Login to post a reply

Server time is: 2026-07-10 12:38:22
Your offset time is: 2026-07-10 12:38:22