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 / Issue with wall coloring

User Offline
Joined: 26th Sep 2016
Posted: 14th Oct 2016 14:05
I am making a 3d environment and the outside walls aren't rendering color on the right side. I can' t even use simple rotation to get it to the side I need. What is going on and please help!!

Here is my source code!
REM Project: The 3D World
REM Created: 10/11/2016 7:41:35 AM
REM Tyler D. Hathaway
REM ***** Main Source File *****
sync on
sync rate 60
hide mouse
Rem **Create Walls**
green = RND(255)
blue = RND(255)
green = RND(255)

REM South Wall
Make Object box 4,3000,1000,1
Color object 4, RGB (255,255,255)
position object 4,0,490, -1500
Rem !same thing as function below!

makeWall(2,3000,1,3000, 0,-10,0,rgb(0,255,0)) REM Floor
makeWall(3,3000,1000,1,0,490,1500,rgb(0,191,255)) REM North Wall
makeWall(5,3000,1000,1,1500,490,0,rgb(255,0,0)) REM East Wall
makeWall(6,3000,1000,1,-1500,490,0,rgb(255, 204, 0)) REM West Wall
YRotate Object 6 ,-270

make object cone 1,10
color object 1,rgb(0,0,255)

if keystate(200) = 1
move object 1,2

if keystate(208) = 1
move object 1,-2

if keystate(203) = 1
turn object left 1,2

if keystate(205) = 1
turn object right 1,2

`Camera settings
rotate camera 0,0,0
position camera 0,object position x(1),object position y(1)+10,object position z(1)
rotate camera 0,object angle x(1),object angle y(1),object angle z(1)
move camera 0,-30


Rem **Create Walls**
function makeWall(ID, xsize, ysize, zsize, xp, yp, zp, color)
make object box ID, xsize, ysize, zsize
position object ID, xp, yp, zp
color object ID, color
set object texture ID, 100, 1
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 14th Oct 2016 20:03
The problem is the default directional light is shining on those walls from behind. Add the code below to your initialization. If you go to one corner and turn around to face the adjacent corner, you will notice the portion farthest away does not show. You may want to set the camera range a little higher to correct this.

make light 1
set point light 1, 0, 50, 0
set light range 1, 7500
User Offline
Joined: 26th Sep 2016
Posted: 17th Oct 2016 14:03
THANK YOU SO MUCH! I knew it had something to do with shadows after days of messing around with it but I couldn't find the right command to fix it!
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 17th Oct 2016 18:21 Edited at: 17th Oct 2016 18:27
You're welcome, Tyler. I have streamlined your code to show a little variation in technique.

+ Code Snippet

Login to post a reply

Server time is: 2017-08-17 14:40:04
Your offset time is: 2017-08-17 14:40:04