Faceting in Displacement Map From Copernicus

   207   0   2
User Avatar
Member
20 posts
Joined: 9月 2020
Offline
Greetings,

First off. COPERNICUS IS AMAZING!! I have wanted a system like this for so long. I know it is in beta so there are many kinks but it has massive potential already..... so many crashes. lol.

I have successfully implemented planar projection for decals and subrance style warp projection. Now I am trying to do displacement generation from a high and low poly mesh.

I am currently attempting to replicate the functionality in the mapsBaker node. My logic is that the mapsBaker node works in the old cops system and copernicus can do everything cops can do with geometry.

I am very close. I can get the overall shape but the displaced mesh has visible faceting from the low poly mesh.

here is the vex I am using in a copernicus wrangle
int prim;
vector uv;
vector hitPos;
vector dispDir;
float dispSwtich;
float dispMag;

// origP is the rasterized low poly world positions
//dispMag is the length to the hit
dispMag = xyzdist(1, v@origP, prim, uv);

//get position on high poly mesh
hitPos = primuv(1, "P", prim, uv);

//get the normalised direction to the high polygon mesh
dispDir = normalize(hitPos-v@origP);

// check the direction against the rasterized low polygon normal
dispSwtich = dot(v@N, dispDir);

//if the direction is opposite the normal direction reverse the displacement value
if(dispSwtich<0){
    dispMag *=-1;

}

@disp = dispMag;

I am basing it off of the code form the maps baker:
float incrementX = (1.0/$XRES);
float incrementY = (1.0/$YRES);

float offsetX = incrementX * 0.5;
float offsetY = incrementY * 0.5;

vector udimoffset = detail($LOW, "__udimoffset", 0);

vector WorldN = $vec;
vector MyN = uvsample($LOW, "N", "uv", set((($IX+1)*incrementX - offsetX) + floor(udimoffset.x), (($IY+1)*incrementY - offsetY)+ floor(udimoffset.y), 0));
vector lowpos = uvsample($LOW, "P", "uv", set((($IX+1)*incrementX - offsetX) + floor(udimoffset.x), (($IY+1)*incrementY - offsetY)+ floor(udimoffset.y), 0));

$DISP = distance($pos, lowpos) * $Alpha;
$DISP = ($Alpha == 0.0) ? 0 : $DISP;

if (dot(normalize(lowpos-$pos), MyN) >= 0) {
    $DISP *= -1;
}

if ($RemapHeight == 1)
    $DISP = fit($DISP, $HeightRange.x, $HeightRange.y, 0, 1);

I have attached an image of what I ma getting in lops as well as the example file.



notes:
I have enabled subdivisions on the sop import node. it helps but the faces can still be seen on the resultant rendered mesh.
I have tested the dicing quality from .1 to 1 and the faceting remains
If I send a generic noise from copernicus to lops there is no faceting> I can see the UV seams but I think that is expected as the pattern becomes discontinuous at those locations.

here is a screen grab of the setup:


Any suggestions or help is much appreciated.

Cheers!
Edited by bryanebentleycgs - 2024年12月11日 03:52:44

Attachments:
copsDesigner_v02_displacment_TS.hipnc (3.4 MB)
Screen Shot 12-11-2024 at 4.02 PM.png (1.8 MB)
Screen Shot 12-11-2024 at 4.51 PM.png (2.1 MB)

  • Quick Links