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.

AppGameKit Classic Chat / [Bug] Set render to image to generate a depth buffer crashes

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jul 2017 06:36 Edited at: 5th Jul 2017 03:48
Please note that i am NOT trying to render to an image. What i am after is a DEPTH BUFFER IMAGE

THE EXAMPLE DOESN'T CRASH BUT IT DOESN'T WORK EITHER. IT PRODUCES TWO COMPLETELY BLACK IMAGES

If i run the following code i just get two black images.

Hit the tab key to try render a depth buffer

If i use the code recommended in the documentation and change the line to SetRenderToImage(rd, -1) i get the attached error

Attachments

Login to view attachments
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 4th Jul 2017 06:45
have you tried to reinstall your videocard drivers ? for me this code doesn't crash
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jul 2017 07:14
No the code as it is doesn't crash but it doesn't work either. It produces two black images.
When you make the changes i outlined it crashes
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 4th Jul 2017 20:30
maybe a ClearScreen() before the DrawObject Commands ?
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 4th Jul 2017 20:44 Edited at: 4th Jul 2017 20:45
indeed it seems that "CreateRenderImage" command doesn't work when we set the format to "Depth" (1) (or the render process doesn't make his job !)

but works well for color Image
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Jul 2017 23:31
Yes it works for image. but i need a depth buffer image and that doesn't work
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Jul 2017 03:47
I updated the code to show the depth render image at top right and the color image at top left.
I also added some code to check the depth buffer image to see if maybe there was some information in the alpha channel (no luck)
I found that by adding ClearScreen() and Render3D() it now renders to the color image. Still not generating anything in the depth image
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 21st Jul 2017 15:06
It's possible your device does not support rendering to a depth image, does the IsSupportedDepthTexture command return 1 on that device?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Jul 2017 16:37 Edited at: 21st Jul 2017 16:41
If the depth image becomes white then its probably right because the depth buffer isn't linear.
The near objects are distributed much more closely to the near plane and are scattered far more towards the far plane.
Also the human eye isn't good in differentiating bright colors from each other.
If it doesn't get white then there could be a hardware problem indeed.
I tested it and it worked for me and after a quick look I found nothing suspicious...
You could also write your own depth shader and write the depth to an RGBA render target

Using AGKv2 Tier1
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Jul 2017 02:13 Edited at: 22nd Jul 2017 02:16
Quote: "It's possible your device does not support rendering to a depth image, does the IsSupportedDepthTexture command return 1 on that device?"

It's windows 10
Quote: "I tested it and it worked for me and after a quick look I found nothing suspicious..."

So was your depth buffer white too? I loaded it into a mamblock and checked each pixel and it was all completely white

In any case this was my feble attempt to understand shaders and create shadows. The new version has solved those problems for me
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Jul 2017 09:46
Set the box very near the camera and you will see
I did that too to find something in the depth preview image... SetObjectPosition(box1, 0, 40, 0) or something

Using AGKv2 Tier1
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 22nd Jul 2017 14:21
Quote: "It's windows 10"

That's the operating system, not device. What graphics card are you using?
Signature removed by mod because it's larger than 600x120... please resize and try again.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Jul 2017 23:49 Edited at: 22nd Jul 2017 23:49
Ill look at all that stuff
my graphics card is NVIDA GeForce GTX 750 Ti

IsSupportedDepthTexture() returns 1

Login to post a reply

Server time is: 2024-09-30 05:39:03
Your offset time is: 2024-09-30 05:39:03