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.

Newcomers DBPro Corner / 3d object coloring only one face.

Author
Message
Ones and Zeros
16
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Western NY
Posted: 9th Feb 2013 02:40 Edited at: 9th Feb 2013 17:02
Playing around with some 3d objects and flying a camera around. I made 2 cubes so far and colored them different colors. When I move the camera past cube 1 colored red and then turn the camera the other five sides of the cube are just gray. Same thing happens to cube 2. Only the sides facing the camera at start up get colored. Is this normal or do I need to do more to color all sides. Also I was thinking of using CSG to hollow out a bigger cube with a smaller cube to make the inside of the cube my game area borders (visually) (Shoot the flying bouncing off wall spheres type thing)and hidden boxes for collision. Would the color goto the inside of the hollowed out cube too? I figured this would be a good way try and focus my learning direction. Come up with an idea and try to make it work.

I made a light and updated its position to the camera position and this seemed to work. Is this the best way? What are other options?
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 10th Feb 2013 22:32 Edited at: 10th Feb 2013 22:33
This is normal. It's to do with the way the default lighting works. There are some commands that are used to alter how light works on an object.

SET OBJECT DIFFUSE
SET OBJECT AMBIENCE
SET OBJECT SPECULAR
SET OBJECT EMISSIVE

I think there are some others, best have a look at the BASIC3D COMMANDS -> APPEARANCE COMMANDS in the help files.

This demo use the SET OBJECT EMISSIVE command.



If you remark out the line "set object emissive 1, rgb(100,0,0)" then some of the faces will turn grey again.

I've not really used the DIFFUSE, AMBIENCE or SPECULAR but you might help you. As you've already mentioned, you could use lights (which are quite slow so you might not want to use them for larger projects) or you could use a texture to give your objects colour. I think you can also set the diffuse, specular and emissive qualities of the object using textures but I might be wrong. Then there are shaders but that's a whole other issue and is something that you might not want to get into straight away.

one of these days I'll come up with a better signature
zeroSlave
14
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 10th Feb 2013 22:49 Edited at: 10th Feb 2013 23:21
Instead of hollowing out a cube to get a playing level, just turn it inside out! SCALE OBJECT yourWorld -100, -100, -100.

As 29 games said, It's a normal behavior. When I'm messing about with colors on objects and such, I typically set up the lighting as follows:



Then test from there!

The reason you are getting grey sides, is because they are 'in the dark'. SET AMBIENT LIGHT percent will set how strong the ambient light actually is. I'm not sure what the default value is (maybe between 30-40%. Not sure :\) I typically set this to 0 so that I can get 'cleaner' looking DBP lighting.

There is no light source hitting the surface, so the ambient lighting will be applied. (It's actually applied all the time and can cause object coloring to look washed out on objects in light.). The ambient color is set to a grey color by default. If you COLOR AMBIENT LIGHT RGB(r, g, b), objects 'in the dark' will be the color you specify. Objects in light will be as well. The RGB is added between the the objects color by lights, and the color and power of the ambient.

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.

Login to post a reply

Server time is: 2024-04-25 02:15:08
Your offset time is: 2024-04-25 02:15:08