🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Texture projection, or something else?

Started by
6 comments, last by taby 3 years, 7 months ago

I want to use a texture to show how far my game pieces can move along the great circle geodesics on the sphere.

I have considered trying texture projection, which from the looks of it, is quite similar to shadow mapping, with the exception that we use an RGB texture instead of a depth texture.

But, is there a better way? Consider that we're on a sphere. I'm wondering if texture projection will work, since it covers only a half of the sphere at a time (so, I guess I'd use two antipodal projections)?

Advertisement

One idea to keep traditional rasterization, but lift the 2D to 3D projection limitations of SMs, would be to render the back faces of a bounding cube or sphere, and its pixel shader calculates exact distance from the already drawn fragments of geometry.

Much easier ofc. would be to do a full screen pass, and for each pixel iterate over all game pieces and draw all their influences in one go. Does more work but less draws and dispatches.

Thanks for the suggestion!

I think I found what want… I will draw 3D arrows, and somehow, in the fragment shader, I will highlight the space unto which a piece can move.

As for influences, I don't know if I'll be using that in the game. Attached is a screenshot from my last game, which does do influences.

A field of a kind of time dilation

Here's a prototype of a prototype lol

the red highlighting shows the possible positions that define a move

Maybe draw in paint what exactly you want to see. I have hard time understanding what actually you want to draw)

Well. here's another shot with what I need.

imagine a game piece at the top of the sphere… the green region is where it can move to

For the 3D arrows, I'll use this mesh:

Sorry, i still have no idea what are you trying to do, maybe try distance function and if its within distance draw the terrain green?

@_WeirdCat_ I was using the dot product, but yes distance d = radius * acos(dot(n0, n1)) should work.

Here's a higher resolution screenshot.

This topic is closed to new replies.

Advertisement