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.

DarkBASIC Professional Discussion / Lighting a Matrix

Author
Message
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 2nd Sep 2011 13:14 Edited at: 2nd Sep 2011 13:56
Ahoy there folks,
Was wondering if anyone could help me out with getting light and ambience to work with a matrix (Because lighting completely baffles me, actually). I'm using the command

set matrix 1,0,0,0,0,1,0,1

which in theory is meant to set the matrix to be affected by light and ambience in the scene, but in practice it does absolutely nothing, as usual only the objects in the scene are affected. Does anyone know what I'm doing wrong?

Thanks in advance

EDIT: MORE INFO! I've found that if i use the 'set shadow shading on' command on any object, suddenly the matrix takes light and ambience. So the problem is fixed, but I have no idea why, and if I decide I don't want shadows it's gonna be a problem

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Sep 2011 16:10
Hi INH Have you got an example ? . I normally use set matrix 1,1,100,100

Cheers.

I'm not a grumpy grandpa
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 2nd Sep 2011 16:43
I do but it's got media, this is a basic mockup of what I'm doing:



(Just use whatever image for grass)

If I add an object and then use 'set shadow shading on', suddenly it works, which is good enough for my purposes. I'm convinced that this is just me misunderstanding a simple concept

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Sep 2011 17:06
I realized that you set ambient to 20 . Try in the same code :




Cheers.

I'm not a grumpy grandpa
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 19:20 Edited at: 2nd Sep 2011 19:57


EDIT : I take back everything I just typed. The Matrix IS taking lighting from my light. BUT, objects are sending a bad type of shadowing. I was totally at a loss about this until now. Thanks for this thread.. LOL

In the picture above, the small box above is sending out light and the box below is casting the shadow based on that box above. The box above is just there to show you where the light is coming from.

Here is an example code that works for me.



so I guess the real problem I am having with the Matrix is how to set the color of the shadow. Because right now, it looks like its bleeding through to my backdrop. Although, changing the backdrop to off or even changing the color of the backdrop didn't change anything in the shadow.

The line : set shadow shading on 101 -- Tells the cube to cast the shadow. You have to set this to each object that you want to cast the shadow with. The Matrix as you can see is receiving the shadow, but as to how to control the color of it yet, I have yet to figure out.

By the way, the Ambient light has no effect on the color of the shadow itself. Only on the objects.

EDIT 2 : THE FOG MADE THE DIFFERENCE !!!



Which sux because now I have to figure out how to keep the fog in the distance the color I want it and yet still keep the shadows working. Man this is a pain.

"Son, I crap bigger then you !"
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 20:08 Edited at: 2nd Sep 2011 20:09
Hope this picture helps you see my problem. Sorry for the double post.



"Son, I crap bigger then you !"
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 21:31
I think if you have to use a shader fog.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 22:06 Edited at: 2nd Sep 2011 22:07
You mean a shader fog for the distance or for the shadow ? Or for both ?

"Son, I crap bigger then you !"
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Sep 2011 22:24 Edited at: 2nd Sep 2011 22:25
For both. I read somewhere that you have to use the same shader for the fog, and shadows, because all shaders set them up differently. Once you use a shader, you have to always use that shader's commands.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 2nd Sep 2011 22:29 Edited at: 3rd Sep 2011 00:58
Hmm.. i'm not really convinced that i'm forced to have to use a shader for this. I mean I figured out how to do everything in that picture without using one shader. And that includes object shadows. Now there are probably better shaders for more tuned coding.. but I am trying to solve this riddle for understanding.. not for making it too fancy. If I can get the background distance to be fogged like I had it before and yet still have the same shadow color of black, then I am right where I want to be. It makes no sense that FOG effects shadow colors though.

"Son, I crap bigger then you !"
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 4th Sep 2011 11:18 Edited at: 4th Sep 2011 12:35
Try set global shadow color R[b],G,B,A[/b]

Edit:
Never mind, I guess it doesn't work...
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th Sep 2011 15:43
It may be a bug with the fog and the shadow shading but sometimes I've found that the order of the arguments have been wrong. You could try instead of R,G,B,A using A,R,G,B. I've not tried the shadow shading yet but sometimes it worth trying.

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 4th Sep 2011 17:26
Yea I moved my question to this thread so I do not hi-jack this thread anymore then I already have.

Sorry Insert.

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

"Son, I crap bigger then you !"
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 4th Sep 2011 21:24
No problems, as I said my issue has a simple (if incomprehensible) workaround, so no worries.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 4th Sep 2011 21:37 Edited at: 4th Sep 2011 21:37
Thanks bro. What I was originally meaning from my first post is that lights can effect the matrix automatically once you update the matrix. Then you setup the lights and then it is all about positioning the light(s) dynamically after that.

I just ended up on a tangent when I realized my fog was messing up my shadows.. :/

"Son, I crap bigger then you !"

Login to post a reply

Server time is: 2026-07-11 08:46:40
Your offset time is: 2026-07-11 08:46:40