• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
TiPiou

Weird result setting up different shaders, need help tracking down the issue

1 post in this topic

Hi there !

The rendering part of my current project consists of a very-very-very basic renderer for a 3D scene :
- I feed a list of triangles to a Vertex shader working with position, colour and uv.
- Vertex shader uses a constant buffer for a world matrix and a viewproj matrix.
- Pixel shader use the VS output, samples the texture, outputs a pixel, and that's it.
It currently deals with no light effect whatsoever. But it works as intended smile.png

Aside from that, I have a different rendering system for sprites and text used by the GUI, which also works as intended smile.png
The sprite rendering system deals with dynamic buffers management and optimization, so the code for setting everything up for a given frame is quite intricate already. Maybe that prevents me from seeing a weird bug I have now, for which I need your insights.

See, I was thinking about going towards a deferred renderer right now (And deal with advanced effects such as lights when I'm there).
So in preparation for this work, I've set up a custom render target for my 3D scene, and render it there instead of the backbuffer. To test this step, I've set up a sprite covering the whole screen, using that new render target as its texture input, and it also worked as intended, blitting the same scene on my screen that I had previously smile.png (yeah, lots of smileys, but this simple stuff got me quite happy alpready)

Obviously, the final stage of a deferred shader would benefit from more advanced pixel operations that what my sprite rendering system was designed to do, so my next step for porting my forward renderer to deferred mode was to remove the "blit as sprite" step, to set up another renderer class using two new shaders, to manually set up a quad covering the screen, and use that for rendering instead of one of my 'sprite' objects. It currently uses the dumbest VS possible, taking a float2 'POSITION' and float2 uv as input, not transforming the input position in any way, outputting a float4(input.pos, 0.5f, 1.0f) 'SV_POSITION', and texture coords (left unchanged).

And... from here nothing is working as intended at all sad.png
The output I get is a quad, sure, but transformed in some way. Transformed with (so it seems), something from the viewproj matrix I use for the 3D scene (when *nothing* in the shader code uses that) : its orientation changes whith the same mouse inputs that would otherwise rotate the 3D view. Its texture is all messed up... What's worse : Out of ideas for the cause of this bug, I used the same "solid yellow, untransformed" renderer used to perform my very first 3D test for that engine (Direct3D11, btw), I got the same messed-up output (no solid yellow at all, seems to weirdly sample the texture still).

I guess when I've found the reason for this bug, I'd laugh at myself for having skipped a very basic initialisation phase between the rendering of the 3D scene to the render target, and the rendering of the final deferred quad, but for the moment I've double-checked and triple-checked my code and found nothing...
Is it possible that some constant buffers (or other resource) set up for being used by a given shader would collide with another shader definition that doesn't use them, and mess the shader input in some strange way ? Should I reset any constant buffer usage to zero on the device context, before rendering with the other shader that doesn't care about them ?

Any other ideas ?

Thank you all smile.png

0

Share this post


Link to post
Share on other sites

Not many answers. I suppose I should have pasted along some code, but since I was clueless as to where the problem was... well. *ahem*. Anyway, I solved this. As expected, I missed an important setup call inside my own renderer classes before actually rendering (Although I didn't quite laugh when I finally found it out). Stroke of bad luck, this call was missing in both the new deferred renderer and the first "solid yellow, untranformed" renderer, preventing me from pinpointing the issue faster.

 

If this can help anyone, I'd simply conclude that it is very unlikely that "some constant buffers (or other resource) set up for being used by a given shader would collide with another shader definition that doesn't use them".

 

Other than that, this topic may be closed. Sorry for your time.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0