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.

Dark GDK / Texture object with image from camera?

Author
Message
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Apr 2011 17:01 Edited at: 7th Apr 2011 17:02
I'm pretty sure this is possible but not sure what combination of commands/flags to use, if there are a few ways then I need the fastest possible method, even if it uses some raw DirectX.

At the moment I use:
dbSetCameraToImage(1, 1, 32, 32);

Which works well but then the object texture is always updated with the camera, I just need to grab the image once to texture the object, and then use the camera to do it again on another object or whatever?

I know shaders use these methods alot but whan I look at some shader techniques I get a bit confused

While I'm here, I also need to texture the object with transparency, so any additional help on this would be appreciated.

Thanks.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 7th Apr 2011 17:12
If it's a flat surface like a mirror, just use the db mirror object command (not sure what the syntax is but it's something like dbMirrorObject....)

The fastest code is the code never written.
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Apr 2011 18:36 Edited at: 7th Apr 2011 19:01
Thanks Hawkblood, I'm not sure I expained what I was doing very well.

I wanted to grab the current camera image and texture it to a plane, but not to create mirror effect, that was the problem, it was acting like a mirror instead of just using texturing the object once.

I figured it out with trial and error:

If I then delete the camera, the texture remains, which is what I wanted


EDIT: Seems just calling dbFastSync() before I texture the object makes it work just like I want.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 8th Apr 2011 01:02
I colour my camera backdrop bright green when setting it to render to an image, but I need to make the green parts transparent when I texture my plane.

I have tried:
dbSetImageColorKey() - does not seem to do anything in this situation.
dbSetObjectTransparency() - various settings don't seem to work.

Pehaps its a mixture of both or something completely different, anyone know?

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 8th Apr 2011 03:14
What about:



I know you're looking for the fastest way, but what about starting with a way that works? Or does it even work?

JTK
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 8th Apr 2011 05:18
I found that setting the bitmap format makes the transparency work a little better than default. Try setting the initial bitmap format to ARGB instead of RGB. I know this helps with PNG files with an alpha mask.

Warning! May contain Nuts!
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 8th Apr 2011 15:07
@JTK - I tried memblocks but could not get it to work, did not persue it as it would probably be too slow as I need to so this in real time every few frames or so.

@WLGfx - Thanks for the info, although it seems I was missing setting the transparency on the dbSetCameraToImage() function, I did not realise it had a transparency flag.

Anyway, I tried this:
dbSetCameraToImage(0, 1, 32, 32, 1);
And I get an exception, I was advised from the dbPro board that this would work, might be a bug with DarkGDK.

I would appreciate it if someone could try this function and see if they too get an exception, I will then report it as a bug, thanks.

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 8th Apr 2011 19:21
To get the transparency to work correctly you may need to render the scene without any ambient lighting affecting. Maybe even fog, etc, too. But then again, the backdrop should still (in theory) work with colorkey settings.

I'll keep an eye on this one because this could be extremely useful.

Warning! May contain Nuts!

Login to post a reply

Server time is: 2024-11-19 12:43:46
Your offset time is: 2024-11-19 12:43:46