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


  • Content count

  • Joined

  • Last visited

Community Reputation

177 Neutral

About mg_mchenry

  • Rank
  1. [quote name='Radikalizm' timestamp='1346956179' post='4977307'] When you create the WVP matrix on the CPU you'll only have to go through this process once for every mesh. However, when doing this in a shader it'll have to be done for every vertex. [/quote] Aha, that would be it. Thanks. My meshes only have a few dozen vertices, so shader matrix multiplication still might be faster. Probably faster. This is a webgl app, so I'd have to test how it works out on low-powered devices with integrated graphics.
  2. So one thing I'm wondering is why it isn't common to have three matrices in the shader - one for model-to-wold space, one for world-to-camera space (is that the same as eye space?), and the projection matrix. In my case, I'm working in javascript. Every object has an mv matrix that still has to be multiplied with the camera matrix before being passed to the shader. There has to be a break even point where it is faster to do that in the shader than in the javascript and I'm just wondering why it isn't normal to do it that way, even for native code.
  3. My matrices are all muddy and I wonder if anyone has a favorite resource for a reference on this. I have a coordinate system where +x is to the right, +y goes into the screen, and +z is up. But it doesn't always quite work out. I tried baking my camera matrix into my perspective matrix. Is that a mistake? Should people avoid that? My camera has x rotation, z rotation, and a location. To get my camera matrix, I start from an identity matrix, do the rotations, then translate by the camera location. Then I have an ortho perspective matrix. I multiply the perspective matrix by the camera matrix and pass that into the shader. Should I keep it separate? Well, it's all mixed up. Moving the camera +z has the opposite of expected result. y also seems to be flipped when moving the camera. Yet, objects appear on screen as expected. Translating objects on the screen acts as expected. I think the camera translations need to be inversed? The model view matrix works exactly as expected. As does the perspective matrix. [EDIT] OK, OK! Before anyone attacks, I see that the camera does not go into the perspective matrix. I took it out and tacked it onto the model view matrix. Makes sense. http://www.opengl.org/archives/resources/faq/technical/viewing.htm It's still not doing the right thing, but I'll work it out.
  4. I think that looks terrific! I've been thinking about trying something like that for about 10 years now, but never got to it. Is this more of a z-buffer issue for you or more about reducing the frame to frame load of rendering distant vistas? What do you do when you have a plane or dragon or whatever is situationally appropriate for your project flying in from a distance? Have you considered logarithmic z-buffers?
  5. Man, I was really looking forward to a response to this topic and I've been watching it every day since. :-/ I'll keep watching just in case.
  6. I'm also beginning to wonder if this has something to do with the intensity of the light on my screen does not scale linearly with the rgb value of the pixel. Maybe 200 and 220 aren't that different, but 240 looks *much* brighter. Or something. Or maybe I'm grasping at straws now.
  7. Someone said that once you apply a ground texture, it's hard to notice. I see this webgl demo has a similar problem on one slope and when it adds polygon detail to the steep area of the slope, the artifacts get worse: [url="http://www.oak3d.com/demo/Engine_Terrain.html"]http://www.oak3d.com/demo/Engine_Terrain.html[/url] I can see that part of the problem there is too much noise in the heightmap. I can see how much it helps to smooth my raw height data. I planned on running splines along the surface in the long run and that will accomplish a similar thing.
  8. Madhed, you're probably right. This is how bilinear filtering on low res high contrast images looks. I feel like I'm missing something though. A few years back, I spent a lot of time doing procedural terrain generation with managed DirectX, using vertex lighting, and I didn't notice these sorts of artifacts. That was using the fixed function pipeline, so I thought I must be doing something wrong. The type of data and terrain are very similar. I don't know. I think this version looks bad even with very small polygons. [img]http://dl.dropbox.com/u/17165428/terrain/example5.png[/img] Here, I've smoothed the normals from above: [img]http://dl.dropbox.com/u/17165428/terrain/example6.png[/img] It looks better, but I can still see it. You have to see it moving or with the light moving. The lines are still apparent. But I'd rather not smooth the normals anyway, because it robs the landscape of depth. The whole thing looks blurry. And to look at the normals, it's not like they are crazy. It's a pretty smooth roll along the terrain. [img]http://dl.dropbox.com/u/17165428/terrain/example7.png[/img] Even with triangles just a few pixels wide, I'm seeing this. [img]http://dl.dropbox.com/u/17165428/terrain/example8.png[/img] It's possible I'm only imagining that this wasn't a problem before, but I'm wondering if the lighting algorithm in the fixed function pipleline was different. My lighting calculation is: max(dot((transformedNormal), uLightingDirection), 0.0) I know I'm being a perfectionist, but I'm certain I'm missing something basic.
  9. My previous post is here: [url="http://www.gamedev.net/topic/626376-per-vertex-lighting-are-these-ugly-lines-normal/"]http://www.gamedev.net/topic/626376-per-vertex-lighting-are-these-ugly-lines-normal/[/url] When trying to light some procedurally-generated terrain, I see these alarmingly bright lines: [img]http://dl.dropbox.com/u/17165428/terrain/example2.png[/img] These lines run along polygon edges, so I thought maybe doing lighting in the fragment shader would help. In that case, the vertex normals were still subject to linear interpolation, and even after re-normalizing, produces almost the exact same sort of lines. I tried vertex smoothing. It helped a little, mainly by removing the areas of highest contrast. I tried tesselating quads into 4 triangles instead of two (with a new generated midpoint), but that didn't help at all. Finally, I decided that the problem must be that I want to filter linearly over a quad and I can only do that when sampling a texture, so I tried packing my lighting data into a texture. This texture has one pixel per vertex. Result: [img]http://dl.dropbox.com/u/17165428/terrain/example3.png[/img] On the left, you see the terrain rendered with the terrain texture using nearest filtering. You can see there is one pixel per vertex and it is centered neatly on it. On the right, you see what it looks like with linear interpolation. I really really really did not expect to see those sharp lines. I expected to see nice blurry shapes. I tried resizing the image in paint.net and was surprised that bilinear interpolation in a image editing tool displays the same lines: [img]http://dl.dropbox.com/u/17165428/terrain/Filters.png[/img] The third image is bicubic filtering. That is more like the result I was hoping for. I feel like I'm doing this all wrong. I don't think I want to generate a higher-res texture just to do some fancy spline interpolation on it. I think I just have to hide the artifacts using some noise from the ground texture, normal smoothing, less contrast, more ambient light, and maybe some noise in the lighting calculation. Any thoughts are appreciated. One more thing: In the side-by side, you can see on the left side, even though all coloring is coming from the fragment shader [s]with no lighting whatsoever (just a nearest-pixel texture lookup), you can still see lines on polygon edges. I have absolutely no explanation for that.[/s] Where can that possibly be coming from? Dumb, dumb, dumb. I accidentally left some lighting in the shader, it wasn't just a texture lookup. When removed, the lines along polygon edges on the left disappears as expected, but the lines remain in the bilinear filter: [img]http://dl.dropbox.com/u/17165428/terrain/example4.png[/img] It just doesn't look "linear" to me.
  10. skytiger, a question about how you are interpolating points in your grid: I would like to use Catmull Rom to subdivide my grid. If I have points defined at each 1.0 unit interval and I want to get the point for x,y = 2.5, 2.5, I could generate values for y=2.5 for x 1 through 4. Then with 4 samples for y=2.5, I could interpolate for x=2.5 on that intermediate spline. I hope that makes sense, but it's obviously the wrong approach. The subdivision would be more oriented to one axis than the other. I'm having trouble explaining what I mean by that without writing a paragraph about it. Maybe it's good enough, or maybe the math magically works in a way that is not intuitive to me. I know there are splines you can use on surfaces, but I really like how Catmull Rom passes through the control points.
  11. Splines. Yes. Good answer. That blog post is full of interesting information. Thanks for posting, skytiger. I kept staring at those nasty linear interpolations and thinking there ought to be a better way. It would be pretty cool if you could define a non-linear interpolation between the vertex and fragment shaders or if the fragment shader could be aware of non-interpolated vertex data. I was surprised the difference it makes even doing a very clumsy smoothing pass on the vertex normals.
  12. I was absolutely sure that I had re-normalized. Until I looked. You're right, it is better and different when the fragment's interpolated normal is re-normalized. It's still not great. I'll post pictures later. It's better, but it doesn't make nearly as striking an improvement as smoothing the normals. Again, I will post pictures later. Smoothing the normals was the answer I was looking for, I think.
  13. clb - thanks for the tips. I switched to GL_LINES for the normal lines. No more silly needles! I tried per-pixel lighting and confirmed what I suspected - there is no point in per-pixel lighting with a directional light. You need point lighting. [img]http://dl.dropbox.com/u/17165428/terrain/example2.png[/img] Live example: [url="http://dl.dropbox.com/u/17165428/terrain/perpixel.html"]http://dl.dropbox.com/u/17165428/terrain/perpixel.html[/url] In the example image, I dropped out the ambient light and am just using the directional component. You both suggested adding noise to the problem, but I'd like to start from something a little less ugly to begin with. I might try smoothing the normals now that I have a better idea what that actually means.
  14. I am lighting a patch of terrain per-vertex in webgl, and finding highlights that stand out way too much between some vertices. Is that normal? Does switching to per-pixel lighting magically solve that. If I smooth out the terrain does it go away? Here is a live example: [url="http://dl.dropbox.com/u/17165428/terrain/terrain.html"]http://dl.dropbox.co...in/terrain.html[/url] [img]http://dl.dropbox.com/u/17165428/terrain/example.png[/img] Separate topic: I am showing the vertex normals to prove they are reasonably sane and they appear to be. I tried to draw lines by drawing triangles where two points are identical, but nothing was displayed at all, so I offset one of the points by a small amount, which is why the lines look like needles. Is that normal? What is the correct way to render lines? My main issue is that the linear interpretation of the light weighting between vertices just seems ugly. Will interpolating the normals and calculating the light weighting per pixel improve things at all for a directional light? Here's my glsl: [CODE] <script id="shader-fs" type="x-shader/x-fragment"> precision mediump float; varying vec4 vColor; varying vec3 vLightWeighting; void main(void) { gl_FragColor = vec4(vColor.rgb * vLightWeighting, vColor.a); } </script> <script id="shader-vs" type="x-shader/x-vertex"> attribute vec3 aVertexPosition; attribute vec3 aVertexNormal; attribute vec4 aVertexColor; uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat3 uNMatrix; uniform vec3 uAmbientColor; uniform vec3 uLightingDirection; uniform vec3 uDirectionalColor; varying vec4 vColor; varying vec3 vLightWeighting; void main(void) { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vColor = aVertexColor; vec3 transformedNormal = uNMatrix * aVertexNormal; float directionalLightWeighting = max(dot(transformedNormal, uLightingDirection), 0.0); vLightWeighting = uAmbientColor + uDirectionalColor * directionalLightWeighting; } </script> [/CODE] I did something similar to this with per-vertex lighting (although using the standard pipeline, not glsl) a few years ago and didn't see these kinds of artifacts: [url="http://claritydevjournal.blogspot.com/2007/12/clarity-progress-week-11.html"]http://claritydevjou...ss-week-11.html[/url] [img]http://3.bp.blogspot.com/_z55pSmkRjK8/R2WYGEAzLsI/AAAAAAAABLU/xQuNj2EHArs/s1600/Week11ZoomInSmall.png[/img]
  15. I just want to submit a few fixes useful for developers learning SlimDX now. I'll gather the changes I've made later today or tomorrow and post them here for starters. Should I check out SVN to see what's going on there? Would you like a patch?