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 / What the camera sees -> Image

Author
Message
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 1st Jun 2008 15:48
I'm a curious sod

I was wondering the other day, is there a way to take what the 3D camera sees and turn it into an image, or project it, or something, say for example I wanted a television screen showing a part of the 3D world, and I wanted to do this by texturing a plain with what the camera is seeing?
Just wondering if there was a 'project' or 'snapshot' command or something.

Thank you.

Lee Bamber - Blame Beer
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Jun 2008 19:08
copy bitmap 0
it's slow but it works.

I have a slightly similar question: how could you render a reflection of a scene without cloning every object?
Can you make DB draw stuff that isn't really there?

It is far better to complete a 10 line program than to start a 10,000 line program.
NanoGamez guy
18
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 5th Jun 2008 18:27
@OBese:
I think you could position the camera where you want the reflection to be and point it at the scene. Then get a picture of it, texture a plain or whatever with that image, and then reposition the camera back to the original place before the sync at the end of the loop.
I think Latch did that for one the the challenges in the DB challenge thread.


What are the chemical formulae of:
Sodium Nitrate, Gallium, Manganese and Einsteinium
Insert Name Here
18
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 5th Jun 2008 18:32
Problem with that is, it wouldn't be like a true reflection. The agle of reflection changes as the angle of veiw changes.

Lee Bamber - Blame Beer
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 5th Jun 2008 19:22 Edited at: 5th Jun 2008 20:16
@INH + Obese

In the DBC challenges I have a reflective "cube" example for the create a screen saver challenge. As the camera angle changes the angle of reflection changes on the object. I haven't looked at it in a while and I don't think I put any notes in it. But somewhere I have an actual light angle reflection algorithm for mirror perspective adjustment - I don't remember if it's in the example from the challenge or floating around somewhere on the forums in the form of another example... but anyway in answer to your question, it is as Nano was saying - position the camera, get image, texture object, reposition the camera. You gotta make sure you sync things right or you'll get infinite reflections within reflections.

Another problem is DBC's GET IMAGE command is too slow to make any real use of the method in real time (like in a game where you're handling lot's of stuff going on at once) unless you really scrunch the camera view down or you have an incredibly fast computer.

@Obese
Quote: "I have a slightly similar question: how could you render a reflection of a scene without cloning every object?
Can you make DB draw stuff that isn't really there?"


You could draw your own stuff on the back buffer and render that to the screen. I suppose with a DLL you could even create a separate scene and project it onto the back buffer and "blend" it in with the DB display. Again, DBC is slow when it comes to memory 2d objects (bitmaps, back buffer, sprites, etc).

If you could figure out the direct x surface that DBC is drawing on and get access to it, you could probably do multiple cameras and environmental mapping with a DLL or two.

Enjoy your day.

Login to post a reply

Server time is: 2025-06-05 23:59:22
Your offset time is: 2025-06-05 23:59:22