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 Discussion / where is the shadow in dbc

Author
Message
HomerS
13
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 29th May 2014 19:59
Hi all,

I can't get the shadow effects in dbc.

Here is my example code.

The demo in dbc only works with a matrix.



Just with a normal light it doen't seem to work.

Toedeledoki
Silverman
13
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 30th May 2014 15:46
hi,

You need more polys to see the shadow, like the matrix. The MemBlocks are used to make objects more polys.
In "Thread subject search". writing your keyword to search (shadow, memblock, etc ...), this is very helpful.

DirectX 9.0c (February 2010)/ DBClassic v1.20
HomerS
13
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 30th May 2014 19:24
Thanks,

So there is no rond shadow on the ground. I thought it to be like a 3d prainting program, showing the shadow.

Does it goes the same way in Dark basic pro? any idea?

Toedeledoki
Silverman
13
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 31st May 2014 14:02
Dbc:
does not produce shadows, we must make oneself.

Dbpro:
it has built in commands to make shadows, but it does not work very well. You can buy Dark Lights for making lightmapping, or use the free-plugin "Evolved's Advanced Lighting system" to produce shadows in real time(intensive calculation).

DirectX 9.0c (February 2010)/ DBClassic v1.20
Attila
FPSC Reloaded TGC Backer
15
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 2nd Jun 2014 22:22 Edited at: 3rd Jun 2014 14:41
Here is an example how to create objects with a lighter and a darker side. It does not provide real shadows on the ground but the objects are lighted by the spotlight.



The Picture show what such a lighted object looks like.

Attachments

Login to view attachments
Attila
FPSC Reloaded TGC Backer
15
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 3rd Jun 2014 14:41 Edited at: 3rd Jun 2014 14:42
And here is an example how to create a shadow on the ground:




Attachments

Login to view attachments
HomerS
13
Years of Service
User Offline
Joined: 8th Apr 2007
Location:
Posted: 3rd Jun 2014 23:46
Looks inpressive!

Why don't you use wrapvalue() instead of wrap360 function??

Toedeledoki
Attila
FPSC Reloaded TGC Backer
15
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 4th Jun 2014 02:11 Edited at: 4th Jun 2014 02:22
Surely! you can use wrapvalue it makes basically the same thing.

Thank you for the compliment!

When DBclassic started as DB 1.0 - a long time ago - the wrapvalue-function was not in it (or did not work as I expected - I cannot remeber the exact reason). Therefore I made my own function and stayed with it.

The programs above are in its functions more than 10 years old. The main trick is to turn off the ambient light and to use a spot light to illuminate the object. This will make a darker and lighter side of the object.

The 'pencil'-shadow in program 2 is made by a second object that is flattened and displaced. This works well for static objects and objects that do not move. Making a shadow with a walking man would be very hard, though.

The second program generates the media needed to run at runtime. This can be found in the Make(Ground/Sphere)Texture-routines. Its easy and fun.

The windowsize of 800x600 is used to allow the use of the backdrop. DBclassic has some problems when the output screen is not in the 4:3 relation but on 16:9.
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Jun 2014 12:17 Edited at: 5th Jun 2014 12:21
Quote: "Making a shadow with a walking man would be very hard, though. "

Ask and you shall receive... actually this isn't of a walking man but borrows the code I wrote for a DBC challenge to create the shadow of a walking robot. This demo, which I also had submitted in the DBC challenges, demonstrates a texture bump-mapping effect to create a rock like texture and a cartoony tiling texture as well as a moving shadow.

If you dig through the DBC challenges, there's a lot of interesting and even forgotten code.



Enjoy your day.
Attila
FPSC Reloaded TGC Backer
15
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 5th Jun 2014 13:46 Edited at: 5th Jun 2014 13:47
WOW

Thanks Latch

that looks great. Congratulations!

based on your program I will try to create a walking man - maybe I can do it.
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 6th Jun 2014 02:10 Edited at: 6th Jun 2014 04:45
Thanks Attila, yours is awesome as well. My code has 2 problems:

1. The shadow has as many polygons the original object
2. My code doesn't account for the contouring of a terrain

If, perhaps, a snapshot or series of textures of a black or gray version of the 3d object to be cast as a shadow could be created/captured ahead of time at different rotations and animation frames, then perhaps a disc object, with the textures painted on it could be used and the points on the disc would rise and fall to the different contours of an environment. Swap the textures according to the objects orientation and animation frame.

Would entail some collision detection at the vertices of the disc. A simpler object would be a plane. Though it could get messy with thousands of frames. Could be key frames only or something based on the frame rate.

I don't really have time to code these days anymore, but that sounds like an interesting challenge. As I type, it doesn't seem as efficient as when the thought came!

Enjoy your day.
Attila
FPSC Reloaded TGC Backer
15
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 6th Jun 2014 14:01 Edited at: 6th Jun 2014 14:04
I managed to make the "walking man shadow". using the same technique - flatten and rotate" but as you stated the shadow has the same number of vertices and will not bend on obstacles in the environment. But its a moving/walking shadow tough.



Attachments

Login to view attachments
Attila
FPSC Reloaded TGC Backer
15
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 6th Jun 2014 14:03
And here is the "walker.x" if you want to run the program by yourself.

Attachments

Login to view attachments
Libervurto
14
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Aug 2014 02:29
@Attila
I like the way you outline your subroutines and functions. I might try that myself.

I have meddled with your wrap360 function. I wonder if this is any faster?


I will have to take a closer look at all the code here, looks interesting.

It's nice to come back and see some old names I recognize.

Formerly OBese87.

Login to post a reply

Server time is: 2020-08-12 03:02:04
Your offset time is: 2020-08-12 03:02:04