#Custom GPU Based Clipmapping for terrain

1 messages · Page 1 of 1 (latest)

frozen gust
#

Uses just 5 instanced static meshes, repeated and scaled to form the landscape. Seems very efficient.. maybe even more so than UE's built in landscape?

sour mural
frozen gust
#

I made it in c++ as a custom actor class

#

i can share the code if you want but its kinda ugly and not commented at all lol

#

this is what i followed to make it

#
sour mural
frozen gust
#

cool! there are some things missing, that can probably just be commented out

sour mural
frozen gust
#

all the JetCollisionGenerator class does it use blueprints and the dynamic mesh functions to simplify the mesh, can work completely without it

#

this took me a few good weeks to get working right with no seams or cracks

#

though i didnt write it from scratch, i ported it from my godot version

#

and that took me alike a month lol

sour mural
#

Well I like the structure of it and your implementation of to work in blueprints . well structured code and any advancements i make Ill be sure to share

frozen gust
#

yeah i thought overriding the OnConstruct function to run editor only code was pretty clever lol

sour mural
#

Three things I want to do
1 Bend the mesh to s Sphere
2 Mip maps based on distance
3 Hight map Tessalation and Granularity distance basesd
4 Spawnables on a sphere
5 coordinate system for the sphere with pre generated buildings landsmarks

#

probable take me like 6 months lol

frozen gust
#

i heard an easy way to "fake" planets with a clipmap is to add curvature based on your z position

#

though thats not a true planet type system

sour mural
#

well the other way is to itterate through all the vertaces and set the equal the distance from the origen of the sphere

#

Next you could apply the heightmap ...

#

The coordinate system runs separately to this and so does the buildings using

the next things is to place a hex grid system like tiles on the sphere
using Goldberg Polyhedra

frozen gust
#

ah yeah a cubed sphere or something right

#

before this clipmap thing i wanted to make a quad tree system that used a cubed sphere for planets

#

but that was a bit out of my skill range lol

sour mural
#

The clip map is just for terrian from distance and vertex of the origional mesh .

this other stuff is for user to click on and build things ...

#

I saw the tutorials on bending a mesh into quads ... that would not work for this .

what you got here is fine .
the purpose is for Terrain generation and mips . and can be adjusted to a sphere especially if the texture and height map is wrapped . ... The grid system should still work based on closest vert

#

distance fileds etc .

still wrapping my head around it ..

#

So the first sample I worked with was Nvada clip map sample and got the code for that in c++ and Direct X but it no longer compiles since the direct X API. They use it simply for planetary texture not original function of moving verticies around and terrain generation

#

you find a clip map under one of the samples

frozen gust
#

ohhh yea i see what you mean

#

this might be too messy to help, but heres my material blueprint i made to actually displace the vertices

#

oof all the parameter names got wiped

sour mural
#

I actually got the whole things working without displacement (implement it later ) but it gives me a great starting point as the grid system works as intended

thanks once again for that code .Its invaluable

frozen gust
#

awesome! im glad to know my code is readable lol

#

oh.. you might not notice until you actually start displacing the vertices, but the seam mesh is backwards

#

but if you set the static mesh component to reverse it will be good

sour mural
#

Ill definitely have to try invert the normal .
good stiching job anyway
A quick question does the displacement happen on that generated grid or separate underlying mesh

so what I'm trying to work out is do I need a mesh underneath it to displace or does the displacement happen directly on the clipMapGrids itself

ie if I have the sphere would the displacement happen on the verticies of the sphere

frozen gust
#

yeah the displacement happens directly on the clipmap tiles/grid vertices

#

you might have to do something like pass the center position of the sphere to the material/shader and when doing the displacement, minus the vertex pos with the center pos, normalize it and scale it with a heightmap

#

i have no idea how collision would work though lol

sour mural
#

I think what would be easier is keep the sphere smooth mip texture only . and then use clip map to add terain and extra features scanning the uv of the sphere texture for UV offset data

#

lots of experimenting to go 2 months at least

#

lol