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 / Multiple Set Shadow Positions

Author
Message
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 19th Apr 2012 23:55
Hello,

I am wondering if it is possible to set multiple shadow positions. The reasoning behind this is to have one set of stationary shadows and another which follows the camera. I've created,positioned and set both point and shadowlights to an object which follows a user camera. It seems the only way to enable casting shadows on different objects from the camera's location is to "set shadow positions" to the camera location. As I move the camera, so does the shadows of the objects away from me. This is fine because the point light attached to the camera acts as a sort of lantern in interior spaces. However, the space I created has a transparent ceiling with beams which cast shadows from a stationary point light some distance above it. I don't want these shadows to follow my camera object because it is almost like an accelerated day time scene. Hard to describe...maybe I should post some pictures or an animation. Thanks for any help you can give ahead of time.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 20th Apr 2012 08:51
Yeah, pictures/video would help a lot, I think...


Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Apr 2012 12:19
Sounds like you want shadows from two lights - the one attached to the camera/player, the other corresponding to the light above the ceiling. As far as I know the built-in shadow commands only support one light for shadows. Could be wrong though.
cyril
18
Years of Service
User Offline
Joined: 6th Aug 2007
Location: 7 miles away from big ben
Posted: 20th Apr 2012 15:06 Edited at: 20th Apr 2012 15:31
There was the "Set shadow light" command, but for some reason my recent test of the command shows no active results as if the command is ignored; I could even pass an illegal light number to the command and it doesn't throw open an errors under DBPro U7.7.

The Set shadow light command has the syntax:

Set Shadow Light Lightnum,X,Y,Z,Range

This might be the solution, but does anyone know the main purpose of this command?

Edit sample code:
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Apr 2012 15:33 Edited at: 20th Apr 2012 15:37
Quote: "As far as I know the built-in shadow commands only support one light for shadows. Could be wrong though"


No, you're right, hence my interest in your shadow mapping shader work. You position the one shadow light and every shadow is cast from that one light source.

Years ago I came up with a bit of code to move the shadow light source smoothly between lights, such that if you were running down a corridor with multiple light sources, the shadow light would blend between them, giving you an averaged shadow position. It effect looked ok for the player, but any enemies far away near other lights had their shadows cast from lights close to the player and it just looked wrong.

Shadow mapping shaders are the way to go. The only real use of the inbuilt shadow commands are for single light source environments (e.g. outside and only the sun as a light source). In that situation they're nice and convenient and worth using.

Edit: Commands ->


Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 20th Apr 2012 21:37
Hello Everybody,

Thanks for your replies. I'm trying to create both static and moveable shadows. In the images attached, you can see the space where I'm trying to achieve this. The image in the upper left corner is the transparent roof/ceiling. The beams which hold up the glass cast shadows from a point and directional light. I wish for these shadows to remain fixed while another set of shadows is to be created from a light source attached to a moveable camera. I set the shadow position to camera, effectively changing all of the shadows positions while the camera moves. If I set the shadow position to some static point within the space, the shadows from the roof remain still, but the chest shadows only move when I select the chest and move it with the cursor. I'm looking to have the chest shadows move when I approach or distance myself from it as well. This works only when set shadow position is attached to the camera. If there was a way to set multiple shadow positions(one static, and one to the camera) I think this could be achieved. If you can think of a solution, please let me know. Thank you
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 20th Apr 2012 21:55
Quote: ""Shadow mapping shaders are the way to go.""


This sounds like it would work, but if I decide to have the lights above the roof move in the future, I would run into the same problem. Is it possible to create a shader for the camera and set the shadow position to a fixed point on the map instead? Maybe the shader for the camera can allow for more flexibility and act similar to the "set shadow position" command. I haven't delved into shaders yet but think you're on the right track. Thank You

Login to post a reply

Server time is: 2026-07-10 09:48:46
Your offset time is: 2026-07-10 09:48:46