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

Spa8nky

Members
  • Content count

    1047
  • Joined

  • Last visited

Community Reputation

230 Neutral

About Spa8nky

  • Rank
    Contributor
  1. Problem solved. This post can be deleted/ignored.
  2. I'm using a method for drawing transparent objects without ordering using the weighted average method found in the following paper: [url="http://Weighted%20Average%20Paper:%20http://developer.download.nvidia.com/SDK/10/opengl/src/dual_depth_peeling/doc/DualDepthPeeling.pdf"]http://Weighted Average Paper: http://developer.download.nvidia.com/SDK/10/opengl/src/dual_depth_peeling/doc/DualDepthPeeling.pdf[/url] The problem with my setup is that the transparent model always draws on top of the opaque model even when I believe I have set up my render states correctly and it should be obscured. The draw method can be broken down as follows: - SetRenderTarget - DrawOpaque - UnsetRenderTarget - SetTransparentRenderTargets - DrawTransparent - UnsetTransparentRenderTargets - CombineTransparent result with OpaqueRenderTarget result I have attached a simple source code and .exe demonstration of the problem. WASD keys and mouse to control the camera. The opaque object is drawn in front of the camera and the transparent object is drawn behind the opaque object. It is not obscured by the opaque object and I am uncertain why this is the case?
  3. [quote] [left][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3]I'd wager you're looking at the value of trailFlags rather than the value of trailFlags[index] - these are not the same[/size][/font][/color][/left] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][/quote][/left][/size][/font][/color] I see now. My C++ experience is 'null'.
  4. [code] char* trailFlags; // array of flag bits for trail points ..... bool someBool = CalculateBool(); trailFlags[index] = someBool ? 2 : 0; [/code] I'm unsure as to how the integer value of 2 or 0 is stored as a flag bit char in C#. 0 appears to be stored as '0x002f6020' in C++. How would I do the same in C#?
  5. So I've been trying to implement your suggestion but it doesn't solve the problem: [code] v = quadrangles[i].Vertices; halfTexel.X = 0.5f / quadrangles[i].Width; halfTexel.Y = 0.5f / quadrangles[i].Height; // [0] Lower Left [1] -- [3] (0,0)--(1,0) // [1] Upper Left | | | | // [2] Lower Right | | | | // [3] Upper Right [0] -- [2] (0,1)--(1,1) v[0].TexCoordDimension.X = halfTexel.X; // Texture Coordinates stored in X,Y Quadrangle Dimensions stored in Z,W v[0].TexCoordDimension.Y = 1f - halfTexel.Y; v[1].TexCoordDimension.X = halfTexel.X; v[1].TexCoordDimension.Y = halfTexel.Y; v[2].TexCoordDimension.X = 1f - halfTexel.X; v[2].TexCoordDimension.Y = 1f - halfTexel.Y; v[3].TexCoordDimension.X = 1f - halfTexel.X; v[3].TexCoordDimension.Y = halfTexel.Y; // Copy the vertex data to the drawer's large vertices array v.CopyTo(vertices, i * 4); [/code] or [code] v[0].TexCoordDimension.X += halfTexel.X; v[0].TexCoordDimension.Y -= halfTexel.Y; v[1].TexCoordDimension.X += halfTexel.X; v[1].TexCoordDimension.Y += halfTexel.Y; v[2].TexCoordDimension.X -= halfTexel.X; v[2].TexCoordDimension.Y -= halfTexel.Y; v[3].TexCoordDimension.X -= halfTexel.X; v[3].TexCoordDimension.Y += halfTexel.Y; [/code] How do I calculate one texel? I have tried: [code] halfTexel.X = 0.5f / game.GraphicsDevice.PresentationParameters.BackBufferWidth; halfTexel.Y = 0.5f / game.GraphicsDevice.PresentationParameters.BackBufferHeight; [/code] and [code] halfTexel.X = 0.5f / game.TextureAtlas.Texture.Width; halfTexel.Y = 0.5f / game.TextureAtlas.Texture.Height; [/code] None of the above produces the correct result [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]
  6. Ok I with you now. How can I determine which UV I am pinching without using conditional statements in HLSL? [quote] u(0) += htw, v(0) += hth - u(1) -= htw, v(1) -= hth [/quote] Am I right in assuming that the pinching method will only work when passing in the UV coordinates as 4 corners of a quadrangle? How would pinching work if the uv coordinates are not four corners of a quadrangle?
  7. [quote name='Nikster' timestamp='1327838881' post='4907297'] The uvs you supply you need to pinch them 1/2 texel, not just move them all by the same value. As in, u(0) += htw, v(0) += hth - u(1) -= htw, v(1) -= hth [/quote] Would you agree that the following clamping method is equivalent to your pinching method? [code] // Half Pixel Clamp (Pinch) //input.Position.x = max(input.Position.x, HalfPixelTexel.x); //input.Position.y = max(input.Position.y, HalfPixelTexel.y); //input.Position.x = min(input.Position.x, 1.0 - HalfPixelTexel.x); //input.Position.y = min(input.Position.y, 1.0 - HalfPixelTexel.y); // Half Texel Clamp (Pinch) input.Position.x = max(input.Position.x, HalfPixelTexel.z); input.Position.y = max(input.Position.y, HalfPixelTexel.w); input.Position.x = min(input.Position.x, 1.0 - HalfPixelTexel.z); input.Position.y = min(input.Position.y, 1.0 - HalfPixelTexel.w); [/code] Neither the half texel clamp or the half pixel clamp produce the correct result when applied either before or after transformation.
  8. [quote name='mikiex' timestamp='1327796430' post='4907186'] Just glancing at this, 3x3 texture is an odd size? Some hardware doesnt like non-power of 2 textures (although is this day and age its less of an issue?) I never tend to use anything lower than 8x8. [/quote] Going the reflection of SpriteBatch, and its accompanying shader, I can't see anything that resizes the 3x3 sprite. SpriteBatch draws it correctly too. [quote] why not use a larger texture and just leave space? [/quote] I could do but I wanted to get to the bottom of what was causing this problem. [quote] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left]Also are you clamping your textures?[/left][/size][/font][/color] [/quote] Yes: [code] sampler TextureSampler = sampler_state { Texture = <Texture>; MinFilter = Point; MagFilter = Point; MipFilter = Point; // None AddressU = Clamp; AddressV = Clamp; }; [/code]
  9. [quote name='mhagain' timestamp='1327778679' post='4907114'] Subtract before transformation, not after. You could even encode the subtraction into your world matrix, but I'd advise to get it working this way first. [/quote] Sorry if I didn't make it clear in my last post but I have already tried that. [color=#000000]input[/color][color=#666600].[/color][color=#660066]Position[/color][color=#666600].[/color][color=#000000]xy [/color][color=#666600]-=[/color][color=#000000] [/color][color=#006666]0.5[/color][color=#666600];[/color] [color=#880000]// [Transformation][/color] [color=#880000]// • Multiplying input.Position by World, then the result by ViewProjection is fast[/color] [color=#880000]// • Concatenating World and ViewProjection matrices then multiplying input.Position by the result is slower[/color] [color=#000000]input[/color][color=#666600].[/color][color=#660066]Position[/color][color=#000000] [/color][color=#666600]=[/color][color=#000000] mul[/color][color=#666600]([/color][color=#000000]input[/color][color=#666600].[/color][color=#660066]Position[/color][color=#666600],[/color][color=#000000] [/color][color=#660066]World[/color][color=#666600]);[/color][color=#000000] [/color][color=#660066]Output[/color][color=#666600].[/color][color=#660066]Position[/color][color=#000000] [/color][color=#666600]=[/color][color=#000000] mul[/color][color=#666600]([/color][color=#000000]input[/color][color=#666600].[/color][color=#660066]Position[/color][color=#666600],[/color][color=#000000] [/color][color=#660066]ViewProjection[/color][color=#666600]);[/color] The lines above in the last post are what I am referring to. It doesn't work either.
  10. I still get the same results with: [code] VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput Output = (VertexShaderOutput)0; // Set world transform here (don't use a static identity matrix as it is slower) float4x4 World = { // [Rotation, Scale] input.Column1.x * input.TexCoordDimension.z, // * Scale X input.Column1.y * input.TexCoordDimension.z, input.Column1.z * input.TexCoordDimension.z, input.Column1.w, input.Column2.x * input.TexCoordDimension.w, // * Scale Y input.Column2.y * input.TexCoordDimension.w, input.Column2.z * input.TexCoordDimension.w, input.Column2.w, input.Column3.x, input.Column3.y, input.Column3.z, input.Column3.w, // [Translation] input.Column4.x, input.Column4.y, input.Column4.z, input.Column4.w }; // 'input.Position.w' should always equal 1 input.Position.w = 1; input.Position.xy -= 0.5; // [Transformation] // • Multiplying input.Position by World, then the result by ViewProjection is fast // • Concatenating World and ViewProjection matrices then multiplying input.Position by the result is slower input.Position = mul(input.Position, World); Output.Position = mul(input.Position, ViewProjection); // [UV Coordinates] Output.TextureCoordinates.xy = input.TexCoordDimension.xy; // [Alpha] Output.TextureCoordinates.w = input.Normal.w; // [Source Rectangles] // • Pass the source rectangles to the pixel shader for processing Output.SourceRectangle0 = input.SourceRectangle0; Output.SourceRectangle1 = input.SourceRectangle1; return Output; } [/code] The SpriteBatch shader subtracts the 0.5 after transformation: [code] // Apply the matrix transform. outputPosition = mul(float4(position, depth, 1), transpose(MatrixTransform)); // Half pixel offset for correct texel centering. outputPosition.xy -= 0.5; [/code] This method also produces the same incorrect result with my shader.
  11. I'm attempting to draw a texture that is 3 pixels by 3 pixels in size. If I draw it using SpriteBatch then the texels are correctly aligned to the pixels If I draw it using Texture Atlas look up then the texels are not correctly aligned and the x coordinate doesn't line up with the SpriteBatch result. If I draw it straight from the original texture without the Atlas look up then the texels are not correctly aligned either. Here is a picture demonstrating the results (All 3 quads have an x position of 100 yet they do not line up): [img]http://www.rhysperkins.com/XNA/SmallTexturePixelAlignProblem.png[/img] I'm attempting to line up the pixels to texels as follows: (C#): [code] // [DirectX 9 - Align pixels to texels] // • Find size of half a pixel for render targets based on their size // In this case render target size is backBufferWidth * backBufferHeight // • The reason that it is 1 / width instead of 0.5 / width is because, in clip space, // the coordinates range from -1 to 1 (width 2), and not from 0 to 1 (width 1) // like they do in textures, so you need to double the movement to account for that Vector4 halfPixelTexel = new Vector4(); // Half Pixel //halfPixelTexel.X = 1f / textureAtlas.Texture.Width; //halfPixelTexel.Y = -1f / textureAtlas.Texture.Height; halfPixelTexel.X = 1f / GraphicsDevice.Viewport.Width; halfPixelTexel.Y = -1f / GraphicsDevice.Viewport.Height; //halfPixelTexel.X = 1f / GraphicsDevice.PresentationParameters.BackBufferWidth; //halfPixelTexel.Y = -1f / GraphicsDevice.PresentationParameters.BackBufferHeight; // Half Texel halfPixelTexel.Z = 0.5f / textureAtlas.Texture.Width; halfPixelTexel.W = 0.5f / textureAtlas.Texture.Height; //halfPixelTexel.Z = 0.5f / backBufferDim.X; //halfPixelTexel.W = 0.5f / backBufferDim.Y; effects[EffectName.Quadrangle].Parameters["HalfPixelTexel"].SetValue(halfPixelTexel); effects[EffectName.QuadrangleBatch].Parameters["HalfPixelTexel"].SetValue(halfPixelTexel); [/code] HLSL: [code] VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput Output = (VertexShaderOutput)0; // Set world transform here (don't use a static identity matrix as it is slower) float4x4 World = { // [Rotation, Scale] input.Column1.x * input.TexCoordDimension.z, // * Scale X input.Column1.y * input.TexCoordDimension.z, input.Column1.z * input.TexCoordDimension.z, input.Column1.w, input.Column2.x * input.TexCoordDimension.w, // * Scale Y input.Column2.y * input.TexCoordDimension.w, input.Column2.z * input.TexCoordDimension.w, input.Column2.w, input.Column3.x, input.Column3.y, input.Column3.z, input.Column3.w, // [Translation] input.Column4.x, input.Column4.y, input.Column4.z, input.Column4.w }; // 'input.Position.w' should always equal 1 input.Position.w = 1; // [Transformation] // • Multiplying input.Position by World, then the result by ViewProjection is fast // • Concatenating World and ViewProjection matrices then multiplying input.Position by the result is slower input.Position = mul(input.Position, World); Output.Position = mul(input.Position, ViewProjection); // [Texel To Pixel Align] // • Half pixel offset for correct texel centering) // • Should be done AFTER transformation? Output.Position.xy -= HalfPixelTexel.xy; // [UV Coordinates] Output.TextureCoordinates.xy = input.TexCoordDimension.xy; // [Alpha] Output.TextureCoordinates.w = input.Normal.w; return Output; } [/code] When using textures larger than 8 pixels this problem does not occur. Can anyone please explain why the texels are not lining up correctly with the pixels with smaller textures?
  12. I have a simple class: [code] public class MyObject { public float A; public bool B; public int C; public Vector2 D; } [/code] I would like to automatically generate GUI objects based on each of the class' properties instead of creating them manually. I thought about this approach, but I am uncertain how to fully implement it: - Iterate through each property of the MyObject class (using reflection?), creating a relevant control based on the property type. - Hook the control data change event up so that each change made will change the original class' property values. Would there be a better approach to this or have I got the basic idea? Any help or advice would be welcome.
  13. Good call, I've rolled my own. Would have liked to seen other examples but I've created one in 79 lines that works well so I'm happy.
  14. I'm after an ASCII table formatter in a similar vein to this one: [url="http://cxc.harvard.edu/contrib/asciitable/index.html#module-asciitable"]http://cxc.harvard.e...dule-asciitable[/url] I'm looking to automatically generate tables using ASCII characters to produce something similar to the following: [code] | Column 1 | Column 2 | Column 3 | ===================================== |FM-8 | 1981-05 | M68A09 @ 1MHz | |FM-7 | 1982-11 | M68B09 @ 2MHz | [/code] The '|' should line up and auto size depending on the number of characters in each cell. Any ideas? Thank you.
  15. [quote] [color=#1C2837][size=2]Note how the bloom in the second screenshot is completely faked and baked into sprites, not created in the framebuffer:[/size][/color] [color=#1C2837][size=2][/quote][/size][/color] [color=#1C2837][size=2] [/size][/color] [color=#1C2837][size=2]That's a good eye you have there, thank you.[/size][/color] [color=#1C2837][size=2] [/size][/color] [color=#1C2837][size=2]I'm still at a loss as to the best way to draw the original sprites before bloom processing, etc. My guess would be that simple shapes of 3-4 pixels in thickness would do it? The post processing should then eliminate aliasing and make the pixels more vector beam like?[/size][/color]