Jump to content

Leaderboard


Popular Content

Showing most liked content on 05/01/2022 in Posts

  1. 1 point
    Iteratively resampling a voxel field and visualizing the VDB tree as cubes might also be an option: https://procegen.konstantinmagnus.de/cubify-meshes
  2. 1 point
    dl_cube_subdiv.hipnc There's probably smarter ways to do this.
  3. 1 point
    @bentraje just use groupfromattribboundary SOP on PRIM 'Cd' endless control.
  4. 1 point
    Thanks for the responses. @Librarian I couldn't quite directly use it since I guess the code is for the mat context. That said I think I get the overall logic. I think its doing Method #2 in the code below. @animatrix The code works as expected. ========== Also just for reference. People from slack group also helped me. Here are the results. Same goal just different execution. Method 1 (from bcarmeli) vector @cdir; vector @raydir; matrix camMatrix = optransform(chs("camera")); //get a matrix with the camera's transforms. @cdir = cracktransform(0, 0, 0, {0,0,0}, camMatrix); //extract out the camera position as a vector @raydir = normalize(@P-@cdir); //get a vector to project pointo from camera f@facing_ratio = fit11(dot(@N, @raydir),0,1); if(@facing_ratio>chf("threshold")){ @group_mygroup = 1; } Method 2 (from David Torno) vector cam = getpointbbox_center(1); //Option 1: Get dir per point vector dir = normalize(@P - cam); //Option 2: Get single point centroid //vector c = getpointbbox_center(0); //vector dir = normalize(@P - c); float d = fit11(dot(@N, dir), 0, 1); if(d > chf("threshold"))i@group_mygroup =1; Will close this thread now. Thanks for the help!
  5. 1 point
    You can achieve this by writing this sort of code inside a Primitive Wrangle: string cam = chs("cam"); float near = 0; float far = -0.01; vector pnear = fromNDC ( cam, set ( 0.5, 0.5, near ) ); vector pfar = fromNDC ( cam, set ( 0.5, 0.5, far ) ); vector dir = -normalize ( pfar - pnear ); vector n = normalize ( primuv ( 0, "N", @primnum, 0.5 ) ); if ( dot ( n, dir ) < ch("threshold") ) i@group_fresnel = 1;
  6. 1 point
    vector campos = chv("campos"); vector lgtpos = chv("lgtpos"); float rough = chf("rough"); vector wi = normalize(lgtpos - @P); vector wo = normalize(campos - @P); vector h = normalize(wi+wo); float lambert = max(dot(@N, wi), 0); float D_GGX_TR(vector N;vector H;float a) { float a2 = a*a; float NdotH = max(dot(N, H), 0.0); float NdotH2 = NdotH*NdotH; float nom = a2; float denom = (NdotH2 * (a2 - 1.0) + 1.0); denom = PI * denom * denom; return nom / denom; } float GeometrySchlickGGX(float NdotV; float k) { float nom = NdotV; float denom = NdotV * (1.0 - k) + k; return nom / denom; } float GeometrySmith(vector N; vector V;vector L; float k) { float NdotV = max(dot(N, V), 0.0); float NdotL = max(dot(N, L), 0.0); float ggx1 = GeometrySchlickGGX(NdotV, k); float ggx2 = GeometrySchlickGGX(NdotL, k); return ggx1 * ggx2; } float kdirect(float rough){ return pow(rough,2) / 2.0f ; } vector fresnelSchlick(float cosTheta; vector F0) { return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); } vector rough_tex = texture(chs("image"),@uv.x, @uv.y); vector diff = texture(chs("diff"),@uv.x, @uv.y); float ggx_tr = D_GGX_TR(@N,h,rough_tex.x ); float ggx_trbase = D_GGX_TR(@N,h,rough ); float k = kdirect(rough_tex.x); float ggx_smith = GeometrySmith(@N, wo, wi, k); ggx_smith = max(ggx_smith , 0.0); //@Cd = diff + ggx_smith * ggx_tr ; vector fresnelv = fresnelSchlick(dot(@N,wo), chf("fresnel" )); @Cd = diff*.2 + ggx_tr* ggx_smith * fresnelv; maybe someone can explain and make this in Real Scene @bentraje
  7. 1 point
    We have a default biped, actually a few. What about the same for vehicles? A default, car character/rig, and semi-truck with a trailer. Use those new vehicle assets in a self tool for the Crowd simulator that demonstrates traffic, lanes, and stop-lights.
×