• 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
Forcecast

Modify pixel position

6 posts in this topic

Hi,

I'm in the process of writing a shader using HLSL and I stumbled upon a dilemma.
The purpose of the shader is to create a splitscreen view by shifting the pixel position.
So you got a pixel with position x,y and it needs to be translate to x'y' and x"y" which should simulate a splitscreen.

In theory this should be possible but since I'm planning to use it as a PP effect (since the shader should only affect the pixels and not the vertices), the fragment shader can't modify the pixel position (except for the depth value) since x&y get fixed after the rasterizer.

The dilemma is whether or not I should drop the idea of the PP effect and make it a complete shader meaning that I can use the vertex shader as well to give me more options in terms of modifiy the pixel position before the rasterizer. Or is there another option which I overlooked?

Thanks in progress

Forcecast
0

Share this post


Link to post
Share on other sites
You would need the source to duplicate, and a target, and you would just do simething similiar to how texture wrapping works in the pixel shader (drawing to texture and then putting that on a quad, duplicated using wrapping might br faster and/or easier tho)

Can you use the modulus function in shaders?

So you have have the pixels 0.0-1.0 in the target, the source has 0.0-0.5, and you get the pixel to copy by doing something like source=targetPixelPos%0.5
0

Share this post


Link to post
Share on other sites
This is something that is not usually done using shaders.

Instead you just set the viewport to the split-screen area and update the scissor rectangle accordingly. (At least with OpenGL; I guess it's pretty much the same with D3D, though)

Afterwards you just render using the standard shaders.
0

Share this post


Link to post
Share on other sites
Thank you both for your input.

I understand that using a render target is the way to go for splitscreen but for my case this doesn't apply.
The pixels need to be remapped spherically, both on the left and the right part of the screen.

Initially I used the word splitscreen to cover the principal but it doesn't apply for it like you would expect.
The viewport doesn't get divided, physically there should only be one buffer to where the data gets draw on to.

Thanks in progress

Forcecast Edited by Forcecast
0

Share this post


Link to post
Share on other sites
Like you said in your first post, the xy is fixed. You can change where you sample from though.

You can render your scene in the normal way to a render target, then do a second pass which that samples from that in whatever way you want.
0

Share this post


Link to post
Share on other sites
He could still do it in a pixel shader by writing the results to an Unordered Access View at the modified positions instead of to a Render Target. I would recommend a gather approach instead of scatter approach, though, as it might synchronisation of the individual threads, while all the threads are independent when implementing a gather based approach. Edited by CryZe
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