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

blend states question

6 posts in this topic

In this operation
OutputPixel = ( Sr.rgba * Sr.aaaa ) ADD ( De.rgba * (1,1,1,1) )
Does the OutputPixel values rgba will be, lets say:

Sr.r = 30.0f
Sr.a = -4.0f
De.r=3.0f

so
OutputPixel.r = (30*-4)+(3*1) = -117.0f
Is that the real output value or the values will be in some way converted to the rage from 0 to 1.
0

Share this post


Link to post
Share on other sites
Hi lomateron!

It all depends on the formats of the textures.
For shaders and blending operations the values from the textures are first converted to floats, then comes the operation (or shader code) and then they are converted to the output format.

If you have DXGI_RGBA8_UNORM for instance, the 8 bits in the input slots (0..255) are converted to a float by scaling to 0.0f..1.0f (e.g. 127 is mapped to about 0.5f). If DXGI_RGBA8_UNORM is the output format it is the other way around. A 0.5f would be mapped to 127. (Note that the next shader or blending operation would read it as a 0.5f, again.) Besides, the input and output floats are always clamped to 0.0f and 1.0f. An operation like yours wouldn't be possible, since the input and output values would both be clamped.

If you would use a float texture, e.g. DXGI_R32G32B32A32_FLOAT, no conversion is necessary, thus the value 123.0f would still be 123.0f in the shader or blending operation. In that case, nothing is clamped. This means, any float value is possible for input and output!
Having said that, you would need a float format for your input and output textures and for your given sample values the operation should work just fine.

Best regards!
0

Share this post


Link to post
Share on other sites
Another question
Sr=(-3,6,1)
De=(-1,5,1)

Op=( Sr.rgb) MIN ( De.rgb)

what happens there?
Op=(-3,5,1)? Edited by lomateron
0

Share this post


Link to post
Share on other sites
Hi!

[quote name='lomateron' timestamp='1347215719' post='4978358']
what happens there?
Op=(-3,5,1)?
[/quote]
Yes, that's correct!

Best regards
0

Share this post


Link to post
Share on other sites
thinking on this but Cant find a way using the blending to make this:
when rendering to a pixel, when the pixel shader returns a float4 pix and
pix.w != 0 replace the pixel rendering to with pix
pix.w = 0 leave the pixel rendering to the same.

the pixel values arent used for displaying colors, they are vectors. Edited by lomateron
0

Share this post


Link to post
Share on other sites
Hi!

I think this is not possible with the blend state alone.
The easiest way to achieve it would be to write a pixel shader. The following line would do the trick:
[CODE]clip( input.color.a == 0 ? -1 : 1);[/CODE]
[url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb204826%28v=vs.85%29.aspx"]Clip[/url] discards a pixel if the argument is negative.

Best regards!
0

Share this post


Link to post
Share on other sites
Under Direct3D 9 you can use fixed function alpha testing to skip pix.w == 0 pixels.
D3D10 and up require you to emulate this functionality by either outputting a zero alpha value or discard()-ing (don't use discard if you don't need to) the pixel.
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