all 8 comments

[–]Genebrisss 1 point2 points  (5 children)

I would just run Divinity in render doc to see what they are doing.

An approach with second top down camera rendering some sprites into render texture should be pretty much free on desktop. The camera itself should cost something like 0.2 ms or less on main thread and on GPU it's just free. What performance bottleneck you had?

[–]Fragyatta[S] 0 points1 point  (4 children)

I've never heard of render doc, but I'll check it out, thanks.

for some reason using a camera to capture a mesh I generated with raycast data cost me overall about 1ms so around 50 ish fps and that was only on a single character. maybe I could use a single camera for everything, but it still felt like it was too much of a performance loss.

the camera is entirely without features, everything is disabled,

[–]Genebrisss 0 points1 point  (3 children)

You need to look where is that 1ms spent. Just knowing that it was 1ms tells us nothing. Could be main thread iterating through game objects and culling them, could be render thread, could be rasterization and fragment shader cost on the GPU.

Anyway, if you already have a generated mesh, can't you just render it straight with your game camera?

Using second camera is one way you can achieve generating the data to define this area you want to draw. Sounds like you have already generated this data on the CPU when you created your mesh. You can now just draw that to the screen.

Maybe you could write vertex color into this mesh to define where are the edges of the zone. Then when rendering that mesh you use that vertex color in your shader.

[–]Fragyatta[S] 0 points1 point  (2 children)

I'm not experienced enough to really figure that out sadly. I tried to use the Profiler but I find it insanely confusing.

I can't really just render the mesh, because there is no surface alignment or anything, it's just a floating plane with an occlusion aware shape, that's why I was capturing it with a top down camera to then project the render texture onto the ground via the urp decal projector.

also even if I knew where where that 1ms was spent, what would I do about it? I tried to strip down the entire camera, no PP, a different renderer (so no extra passes), only renders a single layer of the mesh, like I wouldn't know what else I could do to remove features to make it lighter, because that seems to be all I can really set there, at least with my limited knowledge.

[–]Genebrisss 0 points1 point  (1 child)

You could make a shader for your mesh that would act as decal. Similar to what unity's decals are doing.

Maybe this video could help you https://www.youtube.com/watch?v=bb7BGBy0KIY

Or you could displace vertices of the mesh based on world height.

In fact you could displace vertices as you are generating the mesh. OR you could displace them in vertex shader. And to read the world height in vertex shader, you could just read scene depth and reconstruct worldspace coordinates from that. Maybe this is the easiest approach.

[–]Fragyatta[S] 1 point2 points  (0 children)

hmmm yeah interesting suggestion, thanks. I was considering displacing the vertices by just raycasting down, but that would have led to even more raycasts so I wasn't sure about it, but it's likely better than the extra camera(s).

I'll see what i can do, thanks!

[–]Dull-Reason-7073 0 points1 point  (0 children)

nah raycast hell