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

Volumetric texture arrows axes

13 posts in this topic

Hi,
I'm trying to render XYZ axes arrows using textures and Sprite.Draw(...) method. 
I'm using Matrix.RotationYawPitchRoll(...) for rotation the rendered object around the axes and I want my axes arrows to rotate around it's own origin point in the same direction as the object. 
 
So, my question is, how to make volume XYZ axes arrows texture for further its rotation ?
 
Something like this:[attachment=13581:axes.png]
Edited by Yura
0

Share this post


Link to post
Share on other sites

I am afraid I don't understand your question - can you give a little more detail about what you are trying to do?  You want to add a texture onto your axes, or something else?  Or do you mean you are trying to use a texture to apply the words 'x-axis', 'y-axis', and 'z-axis' to your rendering??

1

Share this post


Link to post
Share on other sites

I am afraid I don't understand your question - can you give a little more detail about what you are trying to do?  You want to add a texture onto your axes, or something else?  Or do you mean you are trying to use a texture to apply the words 'x-axis', 'y-axis', and 'z-axis' to your rendering??

 

I want to visualize the current XYZ orientation by rendering the coordinate axes as three arrows. The arrows should rotate as I rotate the model. I want to render the arrows in a fixed size in the bottom left corner like cylinder geometries, not just lines. I think using a 3d texture with cylinder arrows will be nice solution, but, I may be wrong.

 

Thanks

0

Share this post


Link to post
Share on other sites

Ahh ok - now I understand.  In that case, you want to create a 3d model just like you would any other model, but with the axes pointing in their respective directions in object space.  Then, whatever transformation you apply to your model when you render it, you would just do the same for the axes model.

 

Using a 3D texture is possible, but it would be horribly inefficient because 3D textures use tons of memory.  In this case, it is better to just go with a regular polygonal mesh.

2

Share this post


Link to post
Share on other sites

Ahh ok - now I understand.  In that case, you want to create a 3d model just like you would any other model, but with the axes pointing in their respective directions in object space.  Then, whatever transformation you apply to your model when you render it, you would just do the same for the axes model.

 

Using a 3D texture is possible, but it would be horribly inefficient because 3D textures use tons of memory.  In this case, it is better to just go with a regular polygonal mesh.

 

If you say so... But it must have a static position (left bottom corner) and do not change it while i change lookAtVector etc. Also, it must rotate around it's own origin point, not around of the model. To achive this, I use sprites for drawing static elements (I have few of those) and vertices (VertexBuffer) to draw model. 

Maybe you have some code samples of this, couse I don't know how to build cylinders like a polygonal mesh?  Will be very appreciate

Edited by Yura
0

Share this post


Link to post
Share on other sites

Ahh ok - now I understand.  In that case, you want to create a 3d model just like you would any other model, but with the axes pointing in their respective directions in object space.  Then, whatever transformation you apply to your model when you render it, you would just do the same for the axes model.

 

Using a 3D texture is possible, but it would be horribly inefficient because 3D textures use tons of memory.  In this case, it is better to just go with a regular polygonal mesh.

 

If you say so... But it must have a static position (left bottom corner) and do not change it while i change lookAtVector etc. Also, it must rotate around it's own origin point, not around of the model. To achive this, I use sprites for drawing static elements (I have few of those) and vertices (VertexBuffer) to draw model. 

Maybe you have some code samples of this, couse I don't know how to build cylinders like a polygonal mesh?  Will be very appreciate

 

Ok - I didn't realize that you wanted it to stay in one location on the screen.  In that case, you should apply the rotation from your model to the axes, and use a fixed translation component for putting it into the location you want it.  Keep in mind that the position should be relative to the view position if you want it to follow the camera around as it moves.  Or you could set the view matrix to be the identity when you go to render the axes, allowing you to choose a fixed translation and leave it there.

 

For examples about building cylinders and cones, you can find lots of resources around the net.  I have some of these operations implemented in my engine, Hieroglyph3, which you can download and use under the MIT license.

2

Share this post


Link to post
Share on other sites

And is it possible to use sprites for it? 

The point is that I'm already using sprites and it will be better for me to keep working with them. I can apply world changes to sprite and set origin point of it, so problem with position and rotation are solved. But, I don't know is it possible to draw something else exept 2D texture rectangle or text with help of sprite. If there are some other primitives, which can be drawn with sprites?

 

Here is part of code with sprite:

sprite.Begin(SpriteFlags.AlphaBlend);

//other static sprite figures (which mustn't move)

sprite.Transform = rotation;
sprite.Draw(texture1, new ColorBGRA(0.0f, 0.9f, 1.0f, 1.0f), 
new Rectangle(0, 0, 50, 50), new Vector3(25,25,0), new Vector3(0, 0, 0));
sprite.Transform = Matrix.Identity;

sprite.End();
0

Share this post


Link to post
Share on other sites

In addition to what Jason mentioned in his posts, you should not try to achieve any kind of 3D modelling using sprites, unless you want to make things really hard and inefficient for yourself. Some challenges are worth not taking. wink.png

FYI, it's generally the other way round i.e. sprites are created out of 3D models.

For your particular requirement, it's better you go with polygonal mesh.

1

Share this post


Link to post
Share on other sites

I'm not really familiar with the sprite functionality that you are using, but if you can apply 3d transforms to the sprite's rectangle vertices then you could do a rough approximation using a billboard style rendering.  This would work ok for times when you aren't viewing the axis head on, but it would disappear when you are viewing it head on...

 

However, if you already have 3D models in your scene, then this should be quite similar.  You can either programmatically draw the geometry with cylinders and cones, or you can use your modelling package to create the geometry and just import it like any other mesh.  This is really the better way to approach the problem - I don't think you will be happy with the results when using sprites for this functionality!

1

Share this post


Link to post
Share on other sites

So, sprites are bad idea... Get it)

I understand what you are telling me and I even have an idea how to make it with primitives, BUT, here is another problem: how to mark axes with text (x axis, yaxis... like in picture above).  Those lines will be moving all the time, how to make axis marks (text) to move with their axis arrows?

 

Didn't thought that usual axial arrows will deal so much problems to me smile.png  But I have concrete task and I must solve it.

Thanks all for helping

0

Share this post


Link to post
Share on other sites

I understand what you are telling me and I even have an idea how to make it with primitives, BUT, here is another problem: how to mark axes with text (x axis, yaxis... like in picture above). Those lines will be moving all the time, how to make axis marks (text) to move with their axis arrows?

This is normally done by defining a point in object space of your axes model that you want the text to be located at.  Then you can use your transformation and projection matrices to find that location in screen space.  Once you have the location in screen space, then you can use your normal text rendering system to put the text in the appropriate place.  If you haven't done any manual projection of vertices before, you can check out a 'picking' tutorial for the details, as it uses much the same technique.

 

I hope that helps!

1

Share this post


Link to post
Share on other sites

On more question:

How to make those arrows always in front? When model is moving on it, the arrows are hiden behind the model. Playing with Z-coordinate gives nothing, only changing world position.. Maybe you have some ideas?

0

Share this post


Link to post
Share on other sites

You could render the model first, followed by the axes.  When you render the axes, simply disable depth writes and depth test for that draw call.  This will ensure that the axes are drawn over the model regardless of the shape of the model.

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