#Rendering a 3d map on a 2d diagetic screen

1 messages · Page 1 of 1 (latest)

manic rover
#

Ok so I'm making a mapping system in 3d based on inertial navigation systems.

3d because this is a diving game. I basically want to chart out the player's movements and differentiate height.

Now I'm not sure how to approach this, given it should happen on a device screen held in the player's hands.

Since idk if you can do a line renderer as a canvas element, I was even thinking foregoing the canvas here and just positioning a bunch of stuff so it floats right above the screen.

Basically, my rough idea is this:

Every x distance moved, a new Vector3 point is saved into an ordered list. Then I may need to create an empty game object for every one of those points. Then I'd duplicate the entire object, and scale down its parent to squash it down to the size of a map. I'd also need to flatten every point on the y axis and ideally show the height difference in colors.
Then I'd create a line renderer between all points.

There's more to it but that's the rough outline I'm thinking of right now since I can't think of a more intuitive way to do it on a canvas right now.

This have any merit? Also, I apologize for having posted this in programming too but I guess it could be complicated for experts in only one of these areas, so I haven't really received a legit solution.

cedar ledge
#

Let me try to rephrase this.
You want to trace the player movement on a map that is displayed on a screen that is attached to the player's hand. Am I right ?

If you want to stick to a canvas, you could build a script that, for each new point, maps the 3D world position to the canvas 2D position, adds an image for the point and a stretched image for the line to the last point.
It also needs to "clip" to points and lines that get out of the canvas ; You might be able to make this with some "safe clip" zone around the canvas and masking.

Like you mentioned you could also use 3D elements hovering over the screen if you want to stick to using a line renderer. If might need some tweaks in the materials rendering queue to get it hovering close enough to the screen without ZFighting though.

manic rover
#

There will have to be many blocks

#

But then again, the line renderer might have performance issues

#

I wanted to indicate changes in altitude in line color between points

#

The line would start green, and go red towards the second point to indicate descent

#

But then I would need to iterate between all the points in the list and color the lines accordingly

#

Worst case scenario, I would place the points themselves and color them based on altitude

#

But it would need to be relative to player height and would need some kind of dynamic shader that would automatically color them, rather than using a gajillion material instances

#

I would also try to use some math to eliminate tangling of the lines to not make a mass of the chart. Would only make new lines if I'm going in new directions or at different altituted but that's neither here nor there

#

Just trying to say, it's a bit of an engineering feat, so I'm trying to wrap my head around how I'll design all of this

manic rover
cedar ledge
#

Instead of a simple line renderer, you could also build a script to generate the path mesh yourself, and store the different points altitude/color in the vertex color, used in the shader for tinting the render.

#

Or, if you feel like it, you could also do the lines and points with VFX Graph 😄

manic rover
#

Never thought about vfx. Should probably never think about it, lol?

cedar ledge
#

I don't really know what the colors map to.
But if you want something dynamic you could also for example store the altitude in the vertex data (color, uv....) and make the shader dynamically come compute the color

cedar ledge
manic rover
#

In fact, since I'm leaving these points in actual world space, it would be easiest to just sphere cast from the player or something, then get all the points inside and show them on the screen, a draw a line renderer between them but I guess I'd have to get their sequence in the list too so that I know which way to draw the line renderer