Adam's Lair Forum

game development and casual madness
It is currently 2019/11/17, 01:28

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 2015/11/09, 00:29 
Member
Member

Joined: 2015/11/04, 20:02
Posts: 69
Location: Canada
Role: Hobbyist
To preface, I've spent a few hours trying to solve this problem and I found this topic and tried to follow the steps outlined to the letter, with minimal luck.

I can't seem to get custom shaders to work when attached to the camera, the only thing I can manage to render is a black screen.

The steps I've taken:

  • Create a FragmentShader and VertexShader loaded with my desired code
  • Create a ShaderProgram and assign the Frag and Vert shaders to it
  • Create a DrawTechnique with Blending set to Mask, PreferredVertexFormat set to None, and Shader assigned to my ShaderProgram
  • Successfully test the shader on the default Checkerboard Material
  • Create a RenderTarget and an empty Texture
  • Set the Texture's properties to these mostly default values
  • Create a new Target in my RenderTarget and assign it to the above Texture
  • Assign Output of the default first and second Camera Pass's to my RenderTarget
  • Create a third Camera Pass inside my scene's Camera
  • Add an Input to the third Camera Pass
  • Assign the Input's mainTex to the above Texture like so: The scene is now rendering with the texture's dimensions
  • Assign the Input's Technique to my DrawTechnique. The screen turns black and the settings look like this now
  • Reassign mainTex to my Texture and reconfigure my shader's input variables for testing purposes: like so, with no luck and still a black screen
  • Troubleshoot randomly for a while and make this forum post

Where did I go wrong? Did I miss something? The shader itself seems to work fine when I test it on a single sprite. It seems perhaps the Camera Pass can't identify my custom DrawTechnique properly, as you see here with everything set up it says Undefined => Screen and null right next to the Input parameter.

EDIT: I've made some progress, it never occurred to me to try running the game outside of Dualitor. Things seem to be working now but only if I run the game outside of the Sandbox. Are shaders not supported inside the editor? Any way to fix this?


Top
 Profile  
 
PostPosted: 2015/11/10, 12:33 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
The steps you are taking look correct to me, and in general, launcher and sandbox should behave exactly the same. Now, I think there are essentially three things that I think could have happened here:

  1. I have overlooked an error in your listing, or you unknowingly did something different at one point.
  2. You forgot to switch to the Game View mode, so, in the sandbox, you never looked through the lens of your custom Camera.
  3. There is a bug in Duality that somehow only triggers in the editor.

I will try to reproduce what you're doing in my own setup, in order to verify or reject #3. Of the remaining two, #2 is probably not it. In case #3 turns out to be negative, can you upload a minimal sample project so I can check #1 as well?

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
PostPosted: 2015/11/10, 12:46 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
I have done a similar setup with a basic "tint everything red" shader and it works as expected, both in the sandbox and the launcher. I don't see a significant difference between what I did and what you describe, except for the fact that I'm obviously using a different shader.

Can you upload a minimal sample setup that reproduces this behavior?

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group