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

Uniform grid traversal

11 posts in this topic

Hi everyone,

I wrote a simple ray tracer and I would like to improve it by creating grids. First, I want to create a uniform grid to accelerate the rendering. Right now, I have my triangles in my grid but I am stuck because I don't understand how to traverse it....

I found a tutorial which gives some code to traverse this kind of grid : http://www.clockworkcoders.com/oglsl/rt/gpurt3.htm.
I don't really understand so I am asking you some help.

I understand that I have to find the vessel where the ray is starting, but how can I know which is the next voxel ?

1

Share this post


Link to post
Share on other sites

the ray starts to intersect a wall of a box and exists another wall of that box. Do some ray to plan intersection, determine if its the left up down etc wall, from there you know the next box this ray is going to go into.

1

Share this post


Link to post
Share on other sites

So, I have to compute an intersection of the ray with all the planes of the box ? and for all boxes the ray intersects ?

0

Share this post


Link to post
Share on other sites

I don't know everything off the top of my head. I would assume you can get more detailed information if you search for ray tracing bsp uniform grid or something. That link doesn't look very helpful.

0

Share this post


Link to post
Share on other sites

Thanks for the link. I understand better the algorithm. smile.png

Edited by Pathering
0

Share this post


Link to post
Share on other sites

Thanks for the link. I understand better the algorithm. smile.png

 

You're welcome. Me I think that the 3D DDA is very important but it's not that trivial to understand from a point of view of precision (when exactly to read/write into a not before visited cell) and a simple +- or rounding error wrong and your are a bit off. Sometime I wish floating point numbers were no more and we all went back to using fixed point math as floats are just so inaccurate, but that's another tangent :-)

Edited by jbadams
Restored post contents from history.
0

Share this post


Link to post
Share on other sites

One more question about the algorithm happy.png

In the paper it said : 

 

Next, we determine the value of t at which the ray crosses the ?rst vertical voxel boundary and

store it in variable tMaxX. We perform a similar computation in y and store the result in tMaxY. The
minimum of these two values will indicate how much we can travel along the ray and still remain in the
current voxel

 I think to intersect each plane of the grids (for X, Y and Z), but it seems greedy to compute. Is there a faster method ?

0

Share this post


Link to post
Share on other sites

I said anything...

I know the voxel where the ray starts. Also I know stepx, stepY and stepZ (1 if the ray coordinate is positive -1 otherwise).

Thanks to that I know the equation of my planes : for example if stepX is 1, the equation of my plane is P = minX (minX and maxX are my boundaries of the voxel for X), and if stepX is -1, the equation of my plane is P = maxX.

Same things for y and z.

 

Is it correct ?

0

Share this post


Link to post
Share on other sites

Maybe it's an idea to write your code in such a way that you can later change it into using octrees. Because ray-tracing in sparse voxel octrees can even be done in real-time. smile.png

0

Share this post


Link to post
Share on other sites

Forget it. Future proofing code is the source of all procrastinations (trust me, I am fighting my instinct to do the "smart thing" every day :-) ). When you want to write your improved algo you will know better how to adapt and how to change it. No need to write a thesis about ray intersection abstraction or bit pattern matches. The code used in production renderers using octrees and sparse voxel octrees (whih I think are just a fad and so does John Carmack ;-) ) is so human unreadable that it hurts the eyes. It's layers of hack on hack of bit pattern shifts and masks that you won't know what is going on.

 

Long story short. Just implement what you have and think of speed and other data structures later.

Edited by jbadams
Restored post contents from history.
1

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