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 / Shining light through a .x model

Author
Message
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 29th Apr 2012 19:26
Hello All,

I have an .x model of a building and wrote a small script that allows you to walk both inside and out of it. The walls have windows already carved out of it. I'm trying to get light from an outside source to shine through these windows and into the interior space. There are two problems that I've noticed: 1)If you set the .x models' shadow shading on, it shadows the entire perifery of the builing/model, but does not allow light to pass through the interior. (This inlcudes using the objects' mesh and setting shadow shading accordingly.) 2)It seems that even creating an individual .x file with a wall and floor component (the wall component with an opening already carved out) still doesn't allow light to pass through the opening and onto the floor as it should. Instead, like the building model, it treats the wall component as a whole but doesn't include its rough opening details. Does anyone know if it's possible to bypass this problem. Sorry for the lengthy explanation...Not sure if it was accurately described. Any help is greatly appreciated. Thank You
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 30th Apr 2012 10:58 Edited at: 30th Apr 2012 11:00
edit: deleted. duh thought about shadow mapping

«It's the Shader, shader me this, shader me that»
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2012 14:51 Edited at: 30th Apr 2012 14:53
Quote: "Not sure if it was accurately described."


Physical holes in the walls, i.e. no polygons, should allow light through. But if the holes are made using transparent textures then you could have problems.

Try this code (you'll need an update such as U7.5 for this to work correctly):



Here's a screenshot:



If you change the shader option to 0 you'll get gaps. Is that your problem?
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 30th Apr 2012 16:02
Thanks for the replies,

I think shadow mapping would work, but first the shadows would have to appear properly as in Green Gandalfs' image. @Green Gandalf. Thanks for your sample, I loaded a sample .x file with the wall type I was talking about. It appears that your code sample works...I think I had the first value in set shadow positions set to 0 or -1, you had it to 1. Here's an image of the result. The .x model wall that I loaded into your scene is on the right. This is good news, I'm thinking if I experiment with the light values in the building model, the end result should be much better. Thank you for your help.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 18:30
Is it possible to put a window on after the shadow has been cast?

Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 30th Apr 2012 20:25
Hello Pincho,

Right now the window is a hollowed out .x model. The light in the middle of the shadow was the result I was looking for. If I were to add a window with mullions, the light in the middle of the shadow would contain shadows of the mullions as well. Now, if you were trying to just show the light from the window opening, but not the mullion shadows, I suppose you could map the shadows on first, then load and apply the mullions/(window) after. The only way I experimented with lightmapping, so far, is with 3DWorldStudio. There are probably many other ways to accomplish this as well. I prefer using shadows with dbpro because they can be altered dynamically. I think there is a way to load a 3DWS model in its native format into dbpro instead of exporting an .x or .dbo file, but I don't know the method on how to do this.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 20:41 Edited at: 30th Apr 2012 20:42
I was thinking of refection on the glass. So if you could add the glass afterwards you would have a more realistic window.

Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 30th Apr 2012 21:24
Here's a set of images of another project which includes glass. The main space, glass, and ceiling beams are all separate .x objects. When I treated them as one object, I couldn't isolate the windows transparency, nor was I able to have the ceiling beams cast their shadows on the main space.
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 30th Apr 2012 21:28
Pincho,

I don't think the glass shows any reflectivity though. Apologies for the image size.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 22:16
Weird how the shadow intersects the box shadow.

Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 30th Apr 2012 22:50
I tried setting global shadow shades to 3, but this didn't seem to help. If anyone has an idea on how to solve this problem please let us know. Thank You

Login to post a reply

Server time is: 2026-07-08 14:11:11
Your offset time is: 2026-07-08 14:11:11