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.

Newcomers DBPro Corner / Plain always facing camera?

Author
Message
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 7th Dec 2003 20:56
For my first DBPro project, I've decided to model the solar system. For the sun, I want to add a corona effect. I think the best way to do this is to use a ghosted plain with a rounded texture of the corona. I'll then rotate this around the Z axis whilst centered over the sun.
However, for this to work, I need to always have the plain facing the camera, not matter where the camera is located. How would I go about rotating the plain to always be facing the camera, like the billboarding method used in games?

Thanks for any info.

Tron Software
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 7th Dec 2003 21:28
point object objnum,camera position x(),camera position y(),camera position z()




Boo!
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 7th Dec 2003 21:44
or...

set object rotation zyx objectnum

`in main game loop
set object to camera orientation objectnum

Xander - Bolt Software

Why do the antagonists always have to look so cool?
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 7th Dec 2003 22:17
Thank you

Tron Software
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th Dec 2003 00:38
Ummm...it seems to work fine, but I can't rotate my plains when the "Point Object" function is used....they remain static. I've tried the other method too with the same result. Code follows...



Objects 2 and 3 are the spheres (one ghosted and slightly bigger than the other) that make up the sun and objects 4 and 5 are the plains that generate the corona effect.

Any help?

Thanks!

Tron Software
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Dec 2003 14:04
Don't rotate the sun, just the plains.

Ohh, when using SET OBJECT TO CAMERA ORIENTATION in a particle system, you can roll the object left (ROLL OBJECT LEFT Obj,Ang) by a random angle (like RND(360)) to get a less uniform effect, good for smoke effects because it breaks down the texture similarities.


Van-B


I laugh in the face of fate!
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th Dec 2003 15:30
But I *want* to rotate the sun. Its what gives the sun the "seething" effect because of the rotating spheres around the Y axis.

Anyway, I'll try ROLL OBJECT instead and see if that works. ZROTATE OBJECT seems to be cancelled out when using POINT OBJECT. <shrug>

Tron Software
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Dec 2003 16:57
Ahh, sorry - I meant don't SET OBJECT TO CAMERA ORIENTATION the sun, just the plains. To rotate the sun you could simply TURN OBJECT LEFT Obj,Ang - if you have to align the object to a certain direction, just fix the pivot after rotating it (FIX OBJECT PIVOT Obj).


Van-B


I laugh in the face of fate!
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th Dec 2003 21:52
Its weird.....even though I've set culling to be off for both plains, when viewed from behind, one of them is invisible until you face it from the front again. This seems to be why the corona is dimmer from the back.

Also, no matter what I do, I can't use ZROTATE OBJECT or ROLL OBJECT when the object is either set to face the camera using

SET OBJECT TO CAMERA ORIENTATION

or using

POINT OBJECT CAMERA POSITION X, CAMERA POSITION Y, CAMERA POSITION Z.

I'm totally at a loss here. This can't possibly be all that hard. I've enclosed the full code for creation and loop processing of the sun, if anyone can help.



Tron Software
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 8th Dec 2003 23:29
Ack.....this is extremely frustrating...

Below are some screenshots that illistrate the problem and a link to the code and media. I would be very grateful if anyone could take a look and tell me what is wrong. This is my first project with DBPro and I'm not very good at 3D gfx yet



This is correct and this is how it should look all the time not matter where the camera is located. The corona is made using two non-culled plains with ghosting switched on, one slightly behind the other.



This is where the error starts to occur. One of the plains starts to vanish, its probably intersecting with the one behind or something.



As the angle of the camera changes, the remaining plain that is visible is no longer angled towards the camera.

Here is the link to the code and media (381KB)

http://www.tronsoftware.dabsol.co.uk/downloads/SolarSystem.zip

Thanks for your help. I appreciate it.

Tron Software
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 9th Dec 2003 02:14
OK, fixed

change code commented 'set orientation of corona to camera'

to




Boo!
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 9th Dec 2003 09:52
Thanks Spooky. YOu're a king amongst men. I still get the problem that the plain isn't always aligned to the camera,as in the third picture, but at least both plains are showing now. Guess you can't have everything

Thanks.

Tron Software
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 9th Dec 2003 14:18
OK, after much faffing about and pulling out my hair I got it working.

1.
change setting up of corona plains:



2.
get rid of two lines changing roation order to zyx

3.
change process star to:




Boo!
Rage_Matrix
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Brighton, UK.
Posted: 9th Dec 2003 19:50
Perfect! Thanks Spooky, I couldn't have done this without you. I owe you a drink, dude.

Tron Software
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 9th Dec 2003 19:57
+ =


Boo!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 10th Dec 2003 00:16
In reply to your email. Yes, I messed up, sorry. Second limb command should have been on object 5. Also 2 ghosted plains do not render too well if drawn in wrong order, so you should also set transparency.

I also had plains drawing in wrong order. You wanted 4 behind 5 but I changed it other way round

The idea is to set the 'natural' centre of the plain to a different place than absolute centre. So positioning plain 4 will actually position in at new centre which is 0.05 units further back from camera. 5 will be positioned 0.05 units futher towards camera.

I had all sorts of problems trying to simply position the planes at the sun and rotating them properly without them moving out of orbit.

Re your limb query. All objects are made from limbs, rather like a human has a body, arms, legs, etc. DarkBASIC primitives only have 1 limb which is limb 0. You can do stuff like have a car with a wheel as a limb and rotate the wheels independently of the car.

Modified code:




Boo!

Login to post a reply

Server time is: 2024-11-25 20:36:00
Your offset time is: 2024-11-25 20:36:00