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

Renderqueue / shader system design question

6 posts in this topic

Hi,
Say you have the following contents in a 3d scene/ level:

- x meshes
- y mesh instances of x
- z renderables, being submeshes of x/y
- a unique materials
- shared over the x meshes and used by the z renderables
- of a materials, b of them have alpha maps/ need blending

- I have a different shader / set of states for the materials with/ without alpha maps.

My questions:
- how would you sort out not blended and blended, by material or by renderable?
(by material would mean lots of complexity and switching vertex/indexbuffers a lot for meshes that have both rederables opaque and blended)
- with todays hardware, would you have 2 different shaders or simply set renderstates when you encounter the materials with alpha map and branch in the shader, to only use alphamap if some parameter per material says yes or no? (difficult to tell unless I add some custom vaue, not in my current X file meshes, exprted from max
- or even a step further, just don't distinguish and keep blending enabled always and only use the alpha map if its set as texture in the stage (downside would be that I have to find a way to sort renderables back to front which use materials with alpha map/blending)
- probably it's a good idea to sort the materials to all opaque first and then the ones with blending/ alpha map

Any input is appreciated
1

Share this post


Link to post
Share on other sites

Draw opaque from close to far to maximize use of the depth buffer's quad tree optimizations since the pixels are the bottleneck unless you have thousands of tiny items.

Take a copy of the depth buffer if you want to support deep particles.

Then draw alpha filtered from far to close with depth writing disabled to show each layer.

Edited by Dawoodoz
0

Share this post


Link to post
Share on other sites
Thanks. How would you sort then, based on materials or based on renderables?
My idea now is:

- 2 arrays with material id's, one opaque and one blended
- for each opaque material sort all renderables front to back and draw
- for each blended material sort all renderables back to front and draw
- find an efficient way of doing this without having to switch meshes/ buffers more then needed

If I do this I can switch between the 2 shaders after opaque is finished and set the corresponding states. Only thing I have to figure out is which material is blended/ uses an alphamap (from the source, export from max). Maybe I can abuse a specific emissive color to mark blended = yes and then in the blended/ alphamap shader, don't use emissive in the lighting calculations? This might be a bit tricky, but no high risk.
0

Share this post


Link to post
Share on other sites

I only sort by instances since anything advanced will just move the bottleneck to the CPU.

 

I use one opaque/alpha flag for the whole model and design with separate instances. This is not a problem since it is mostly particles and breakable windows that use alpha filtering.

 

I once tried removing the code that changed textures and the framerate did not change at all.

1

Share this post


Link to post
Share on other sites
Ok clear. That's what I do today but with one downside:

1. I design a scene in 3ds max, containing for example 80 subobjects/ objects
2. Within them 5 of them are blended/ useapha blended textures
3. I know have to make several exports of the scene to distinguish the subobjects that need to be marked as blended

I could solve this by making/ using another mesh format, but I think this will not solve it. Now I think of it, I could simply export the whole scene twice, one for opaque and one for blended. I can use max group filters to hide one of the 2 groups easily and not include them in the export. Then my renderqueue sorts all submeshes like it does today, per mesh. For blended I already sort back to front, I can add front to back for the opaque renderables. That way a specific material is not perse opaque or blended, but only if the object/ renderable that uses the material, is.
0

Share this post


Link to post
Share on other sites

Try to normalize your collection of istances to the first normal form without sub objects so that they can be easily sorted as one list. Design many models in separate files and place them in a level editor to allow dynamic physics, multiple detail levels and easy reuse of models between games.

0

Share this post


Link to post
Share on other sites
Thanks dawoodoz. Ideally I think your right. Up till know I didn't find the motivation to build a 3d level editor, where 3ds max fills in around half of what I need. I'll think about it.
Till know it's always pencil and paper, excel and notepad :)
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