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 / enviromental reflaction shading

Author
Message
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 4th Jul 2003 18:10
does any one know how to make a surface reflect what is around it and have a texture, ie make a surface that has a texture but reflect the enviroment?
Its not a bug, Its a feature
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 4th Jul 2003 18:26
i have seen it done before but could do with a hint as to how to do it??

Its not a bug, Its a feature
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 4th Jul 2003 18:27
Well, if you don't really need accurate reflection, but just to make an object looks reflective to surrounding, you can try sphere mapping or cube mapping.

Sphere mapping needs a texture map that depicts the surrounding environment, i.e. imagine you flatten your 3-D surrounding scene into a 2-D texture.

Cube mapping produce the same result as sphere mapping, but it requires six texture maps, which are the snapshots of left, right, front, back, top, bottom, of the surroundings.

Both of these effects will produce somewhat that you want, but it is not a real time effect. Meaning that if your surrounding is changing, the reflection won't change unless you change the texture map dynamically. It produce somewhat less expensive but convincing reflection shading.

You can run the example on sphere mapping that came with DBpro to get a better idea.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 4th Jul 2003 18:30
The only problem with this is i would need a surface that reflects the exact enviroment, i would be placing a moving model on the reflective surface, which unfortunatly means it would be unrealistic for it not to reflect the moving model

Its not a bug, Its a feature
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 4th Jul 2003 19:19 Edited at: 4th Jul 2003 19:20
Well, you could try fiddling around with the different multitexture commands, and see if one of those lets you apply a second texture to your objects. However, I doubt that would work.

Instead, what would work is create a second surface right above your reflective surface. You can then texture and ghost this second surface and, after making sure backface culling is on, it won't show up in the reflection, but will seem like it is the surface doing the reflecting.

Hope this helps!

Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 4th Jul 2003 19:21
i had though of that but i wasn't sure if it would work, i will give that a try and post the results here after the weekend, keep the suggestions comming

Its not a bug, Its a feature
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 4th Jul 2003 19:31
Dynamically changine the cube maps is very slow indeed.

I tried DooMer's technique. It works, but not very well with the current ghost command. P5 will have true alpha support, so you will be able to produce a much better result using that trick.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 4th Jul 2003 20:02
can't wait till p5!!!!

Its not a bug, Its a feature
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 7th Jul 2003 12:50
right, yet again another question. Ghost command, how do you set different levels of transparancy?

Its not a bug, Its a feature
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 7th Jul 2003 12:57
@superchief

"Ghost command, how do you set different levels of transparancy?"

You can't, at least not untill patch/upgrade 5.

Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Jul 2003 13:18
don't use ghost...
instead make a trasparent image and then set the trasparency flag on the object to 1

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Jul 2003 14:05
"instead make a trasparent image and then set the trasparency flag on the object to 1"

Thanks to Kevil for this one:




Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
Yuri
23
Years of Service
User Offline
Joined: 12th Jun 2003
Location: Italy
Posted: 7th Jul 2003 19:13
error - variable 'percentage#100' does not exist at line 74
error - variable 'percentage#100' does not exist at line 79
error - variable 'percentage#100' does not exist at line 88
error - variable 'percentage#100' does not exist at line 93

after correcting above problems, pressing t produce:

error - memblock position outside range at line 119

and pressing o produce:

error - memblock position outside range at line 135

tested with darkbasicpro + patch 4.1 c933 256Mb dx9


CBMZone main administrator
http://www.cbmzone.com
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 14th Jul 2003 11:43
ok people, i give up, i have tried to do his with no success. I have a bsp map, no floor. i have tried to load a plane surface with reflection shading on it, then put a transparent plane above the mirrord one, all i get is the bsp room being completely black and the floor is not there at all.

I can use a bsp map by itself, a reflection map by itself but why when i put them all together does it cock up? Anyone got any clues?

Its not a bug, Its a feature
Barliesque
23
Years of Service
User Offline
Joined: 10th Nov 2002
Location: Los Angeles
Posted: 14th Jul 2003 14:03
Here's a debugged version of the code snippet above...



Nice.
Barliesque
23
Years of Service
User Offline
Joined: 10th Nov 2002
Location: Los Angeles
Posted: 14th Jul 2003 14:04 Edited at: 14th Jul 2003 14:09
Here's a debugged version of the code snippet above...

EDIT: Oops. Didn't mean to send this twice.
Giles Papworth
23
Years of Service
User Offline
Joined: 7th Feb 2003
Location: In my own little reality
Posted: 14th Jul 2003 18:32
cheers, will try that when i am home

Its not a bug, Its a feature
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th Jul 2003 21:13
Woops! - I posted the original source, not the corrected one. Sorry folks

Ishamael Sedai
23
Years of Service
User Offline
Joined: 1st Jul 2003
Location: France
Posted: 14th Jul 2003 21:22
hmm you can apply one of the camera view on the mirror or what u want... i think....
SET CAMERA TO IMAGE
This command will direct all camera output to the specified image. This command is ideal for performing the fastest method of creating textured polygons that show a different view within your 3D world. You can use this command to create mirrors, security cameras within your game or dynamically moving the camera view around on a polygon shape such as a floating panel.

SYNTAX
SET CAMERA TO IMAGE Camera Number, Image Number, Width, Height

I am the Betrayer of hope naebl'is by the will of
the Great Lord of the Dark. If you do not want to surrender, your soul will burn in the deepest hole of the Pit of doom.
Ishamael Sedai
23
Years of Service
User Offline
Joined: 1st Jul 2003
Location: France
Posted: 14th Jul 2003 21:25
but with bsp.........

I am the Betrayer of hope naebl'is by the will of
the Great Lord of the Dark. If you do not want to surrender, your soul will burn in the deepest hole of the Pit of doom.
Yuri
23
Years of Service
User Offline
Joined: 12th Jun 2003
Location: Italy
Posted: 15th Jul 2003 14:31
now it work, but if i change the resolution from 32 bit to 16 bit the same mem banks error appear

error - memblock position outside range at line (linenumber)

CBMZone main administrator
http://www.cbmzone.com
Ishamael Sedai
23
Years of Service
User Offline
Joined: 1st Jul 2003
Location: France
Posted: 15th Jul 2003 17:44
Quote: "
Function Get texture for object reflexion (objnum,imgnum,ax,ay,az,cheight)
cx#=camera position x()
cy#=camera position y()
cz#=camera position z()
rx#=camera angle x()
ry#=camera angle y()
rz#=camera angle z()
position camera object position x(objnum),object position y(objnum)+cheight,object position z(objnum)
rotate camera wrapvalue(ax),wrapvalue(ay),wrapvalue(az)
sync
set current bitmap 0
mirror bitmap 0
get image imgnum,0,0,640,480
cls
sync
cls
position camera cx#,cy#,cz#
rotate camera rx#,ry#,rz#
cls
sync
endfunction
*****************************
*****************************
function Execute Object reflexion range (fr,txo,u#,v#)
for objnum = fr to txo
if object in screen(objnum)=1 then scroll object texture objnum,u#,v#
next objnum
endfunction"

if it can help

I am the Betrayer of hope naebl'is by the will of
the Great Lord of the Dark. If you do not want to surrender, your soul will burn in the deepest hole of the Pit of doom.

Login to post a reply

Server time is: 2026-07-21 12:50:06
Your offset time is: 2026-07-21 12:50:06