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 / [3D] Shader : output, orthographic view (shadow mapping)

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 3rd Dec 2015 08:26
Hi

I would like to know if we can send a shader to an output texture, I'm looking for an equivalent to " layout(location = 0) out float textureoutput;", from : http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/

Another question : is there a way to get the orthographic view ?
We have :
agk_WorldViewProj - combined world, view, and projection matrices
agk_WorldOrtho - combined world and ortho matrices for sprites


In my vertex shader, I have tried :


But it doesn't work.

I'm trying to do the shadop mapping tutorial, any help would be great .
http://www.dracaena-studio.com
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 3rd Dec 2015 17:17
You can render to a texture using SetRenderToImage()

The orthographic matrix uses the screen resolution as its bounds, so it goes from, say, 0 to 1024 and 0 to 768, which may not match the 3D world very well. It's mainly for sprites. You may have to construct an orthographic matrix in the shader from some uniform values, then use agk_View and agk_World like this

You only want to multiple by the orthographic or projection matrix, not both.
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 7th Dec 2015 11:34
Hi

Thank you for your answer.
I have tried to create a simple example to have a reflection.
It work, but I don't know if there is a way to get an orthographic view with the camera.

Quote: "You may have to construct an orthographic matrix in the shader from some uniform values
"

I'm sorry, I don't know how to construct an orthographic matrix in the shader ^^
What is myOrthoMat ?


Here is the code for a reflection/shadowmap, If the camera should be orthographic, I think it could work ^^ :

http://www.dracaena-studio.com
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Dec 2015 16:09
Try setting a really low agnle in setcamerafov for ortho.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Green7
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 21st Jan 2016 20:42
Any news on this? I would love to see some directional shadow maps...
Green7
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 3rd Feb 2016 16:03

Login to post a reply

Server time is: 2024-11-25 11:40:50
Your offset time is: 2024-11-25 11:40:50