Jump to content
  • Advertisement
Sign in to follow this  
binchawpz

Displaying multiple dynamic 2D pictures on a 3D shape

This topic is 3789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to develop an interesting effect and cannot determine how to approach it. The topic, "Displaying multiple dynamic 2D pictures on a 3D shape", is a fairly accurate depiction of what I would like to do. I'll start with a simple example in an attempt to explain it clearly. Start with a black sphere on a white foreground. The sphere itself will not have any response to light, as it is not the focus of the effect. On this sphere there will be 100 randomly placed colored "sprites". These sprite objects will then be assigned a direction and a velocity and will then proceed to orbit around the surface of the sphere. These could be anything from simple dots to more complicated pictures. As these sprites move around the sphere, they should stay wrapped to the surface as if they are a texture. Even with the sphere as a simple example I don't really know how to implement the effect. Because there are so many different sprites it would be harder to do as a texture (a single texture wouldn't work as they would all move in one direction. The texture would have to be dynamically built every frame to take into account the location of the sprites). Ideally I would like to be able to apply the same effect to complicated objects such as character models, however getting it to work on basic shapes would be enough to get me started. I have not been able to find anything on Google, however if this is a known technique I could likely find everything I need if I could get some assistance with what I should be looking for. Thank you for your time. Shane

Share this post


Link to post
Share on other sites
Advertisement
Rendering your sprites to a cube map is the first idea that comes to mind. Yes you'd have to dynamically generate this every frame, but it can be relatively cheap if you can batch your sprites into one draw call per cube face. This approach would also be the easiest to extend from something like a sphere to arbitrary meshes.

Share this post


Link to post
Share on other sites
Cubemapping looks like it will be the ticket. I'll just need to figure out how to properly paste sprites in tricky places like the corners/edges of the cubes without distortion and do a couple other things (such as coloring the sprites based on what section of a mesh they are on, etc). I should be able to do a batch draw job to cube rolled flat (t shape) and just get it done in one draw assuming I can split sprites on edges/corners. Then I could just bind that to the cube. If you have any advice, it would be welcome. However this will be more than enough to get started experimenting.

Thanks,
Shane

Share this post


Link to post
Share on other sites
Just do a render to texture and set up your projection matrix to orient on the face you want to render.

The cube map seems like the simplest approach, especially for a sphere. But it may not give you what you want for more complex shapes. Especially if they are not convex. Sprites could jump from point to point on the surface or move at uneven rates. In extreme cases you could get the same sprite appearing more than once on the surface if the surface was complex enough.

A more involved solution would be to come up with a mapping from the 2d space the sprites are in onto the surface. Then, for each sprite you would render the faces which are mapped to it's 2d position (similar to doing a decal effect). You'll probably draw more geometry this way, but you'll save on the overhead of the render to texture. This would be a little more work to implement too.

Share this post


Link to post
Share on other sites
Another suggestion just throwing it in the bag:

Have several spheres inside one another with a sprite drawn on each one and the rest of the sphere transparent. Then as these spheres revolve you would get the effect you desire!!!!

Share this post


Link to post
Share on other sites
You can avoid distortion at the edges of the cube faces rotating each sprite quad so that it's tangent to an imaginary sphere. Or in other words, if you have a vector going from the eye to the quad called "eyeToQuad", the face normal of the quad (treating the quad like a plane) would be -eyetoQuad.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!