• 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
Nick Karasch

All matrix operations in shader?

6 posts in this topic

I ask my Graphics Programming professor if I could use something I am familiar with like GLM and he said no, we are supposed to do everything in the vertex shader. From my experience/understanding, it makes more sense to calculate the model-view-projection matrix once per model for this simple program and pass it in through a uniform.

 

I think he wants us to create all of the matrices in the shader code, can that ever make sense? I don't understand why you would EVER create your main view and projection matrices within a shader. Thanks

0

Share this post


Link to post
Share on other sites

Whether or not you can think of a good reason to do it in production is an entirely separate question than why your professor wants you to do it in a particular way. It might feel a bit icky, but the professor might well have a good reason for doing things this way, for example, if the exercise intends to show that students know how to multiply matrices together, or matrices and vertices, inside a shader, then the instructor might (probably rightly) believe that this exercise is a simple way to demonstrate the students' abilities by using a concept everyone ought to know. If they chose a more "real-world" scenario, then he's no longer grading the students' ability to do matrix/vector math in a shader, but also in their ability to solve whatever other problem he presented, which might not be level-appropriate.

 

In short, programming in a educational environment has very different requirements than in a production environment. Just give the professor what they are asking for, and don't worry about demonstrating the "right" or "best" way of doing things -- that's not the assignment. If you're ahead of the game enough to know that there are better ways, you're already doing fine. And if you feel the need to scratch the itch of doing it right, no one's stopping you. That's what learning is all about.

2

Share this post


Link to post
Share on other sites

Thanks for the friendly reply. Yeah it is very frustrating, I have my 4000+ line "3D engine" I have been working on that would make this assignment take 10 minutes. I expected I could just strip it down to the essentials and reuse my code for these assignments. Now I'm having to start over, sweating over finding a new way to do the basics in the way he wants.

0

Share this post


Link to post
Share on other sites

Well, to be fair, he's not asking for your old work, stripped down. He's asking for new work, the same he expects of everyone else. If you could hand in work you've already done, it wouldn't be fair to the other students, nor would it be a particularly good showing of how well you understand or retain the material currently -- that is, it doesn't say much that you were able to recycle some code you wrote last year over the course of perhaps weeks, compared to the other students who wrote their code last week in a few hours. College isn't about rubber-stamping you for knowing certain things, its also about vetting your ability to work to requirements, meet deadlines, and to some degree determine your performance relative to your peers.

 

And just to be additionally clear, there probably are plenty of reason you might want to do MVP in your shader -- for instance, if you do instanced rendering, V changes for each instance, possibly M, but probably not P. If you have a lot of instances, its probably more efficient to do it in the shader. You could precalculate the entire array if instance MVPs on the CPU and pass them up to the shader, but maybe its less efficient, or maybe you're CPU-bound, but not GPU-bound. Or, maybe you're re-deriving M, V, or P from a compressed form to save space in your constant buffers.

Edited by Ravyne
0

Share this post


Link to post
Share on other sites

Thanks, I don't know about instanced rendering yet but now I have something new to read about ohmy.png

 

I think it's all opinion but I disagree about me reusing my work being unfair to other students. If I have spent 12 hours a day working on this stuff since school resumed, I don't think it's unfair for me to get to reuse code. It's also NOT unfair to me that I have to start over, I wasn't trying to say that either.

0

Share this post


Link to post
Share on other sites

Thanks, I don't know about instanced rendering yet but now I have something new to read about ohmy.png

 

I think it's all opinion but I disagree about me reusing my work being unfair to other students. If I have spent 12 hours a day working on this stuff since school resumed, I don't think it's unfair for me to get to reuse code. It's also NOT unfair to me that I have to start over, I wasn't trying to say that either.

 

If it makes you think, it was probably worth it

If it's so easy, add easter eggs :)

Or refactor your engine after your done.. It's a lifelong never-ending ever-changing profession

Try to avoid being like me though, i recently removed an extra space in a code line and comitted it..

0

Share this post


Link to post
Share on other sites

Shader code is easy to review and everything is at one place. This make your professor life easier. Also it's make cheating harder because not many examples at internet do all canera related calculations at vertex shader.

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