{"id":3754,"date":"2022-10-09T19:19:14","date_gmt":"2022-10-09T19:19:14","guid":{"rendered":"https:\/\/cocoalopez.com\/blog\/?p=3754"},"modified":"2024-01-11T01:32:52","modified_gmt":"2024-01-11T07:32:52","slug":"fake-sss-for-3ds-max-viewport","status":"publish","type":"post","link":"https:\/\/cocoalopez.com\/blog\/?p=3754","title":{"rendered":"FAKE SSS for 3DS MAX Viewport"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"537\" data-attachment-id=\"3756\" data-permalink=\"https:\/\/cocoalopez.com\/blog\/?attachment_id=3756\" data-orig-file=\"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?fit=1016%2C784&amp;ssl=1\" data-orig-size=\"1016,784\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"imagen-7\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?fit=300%2C231&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?fit=696%2C537&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=696%2C537&#038;ssl=1\" alt=\"\" class=\"wp-image-3756\" style=\"width:692px;height:534px\" srcset=\"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?w=1016&amp;ssl=1 1016w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=300%2C231&amp;ssl=1 300w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=768%2C593&amp;ssl=1 768w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=482%2C372&amp;ssl=1 482w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=746%2C576&amp;ssl=1 746w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=400%2C309&amp;ssl=1 400w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=696%2C537&amp;ssl=1 696w, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?resize=544%2C420&amp;ssl=1 544w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-vimeo wp-block-embed-vimeo wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/vimeo.com\/41147048\n<\/div><\/figure>\n\n\n\n<p>Code over here:<\/p>\n\n\n\n<p><a href=\"http:\/\/www.aardolino.com\/blog\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.aardolino.com\/blog\/ <\/a><br><br>or<br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/i0.wp.com\/www.aardolino.com\/wordpress\/wp-content\/uploads\/2012\/04\/SSFSSS.png\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.aardolino.com\/wordpress\/wp-content\/uploads\/2012\/04\/SSFSSS.png?w=696\" alt=\"\" class=\"wp-image-387\" title=\"SS&amp;FSSS\"\/><\/a><\/figure>\n\n\n\n<p>Playing Remedy\u2019s Alan Wake for Xbox, and feeling lost seeing its marvelous forest environment, wondering about how to procedurally animate trees and vegetation using vertex colors, the idea of SS&amp;F-SSS came out: <strong><em>use mesh thickness to modulate a SSS color<\/em><\/strong>. [Yes\u2026it\u2019s not related to trees and vegetations actually]<br>I\u2019m confident that this approach was discovered a lot of time ago, but I implemented it as coding exercise.<br>As first step I developed a maxscript function to evaluate the mesh thickness; the function casts a ray for every vertex normal (inverting their direction) and store the collision distance in the vertex\u2019s color. After that some tuning is needed to get better results; this tune is usually a couple of blur passes.<br>This is the maxscript code to find the mesh thickness:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">--convert a value to 0-255 range\nfn UT_to255 _min _max n =\n(\n    local result = ((n + (-1*_min))\/float(_max))*255\n    return int(ceil(result))\n)\n \n--cast a ray for every mesh vertex and store the ray distance in the vertex color\n--NOTE: a vertex color tune is needed!! use the vertexPaint modifier\nfn aa_bakeMeshThickness theMesh =\n(\n    local rm = RayMeshGridIntersect()\n    rm.Initialize 10 --init. the voxel grid size to 10x10x10\n    rm.addNode theMesh\n    rm.buildGrid() --build the grid data (collecting faces into the grid voxels)\n    local theGSMesh = snapshotasmesh theMesh\n \n    local theColorArray = #()\n \n    for v = 1 to theGSMesh.numverts do --go through all verts of the Geosphere\n    (\n        local thePos = getVert theGSMesh v --get the position of the vertex\n        local theNormal = -(getNormal theGSMesh v) --get the normal of the vertex, reverse direction\n        local theHitsCount = rm.intersectRay thePos theNormal true --intersect the ray with the sphere\n        if theHitsCount &amp;gt; 0 then --if have hit anything...\n        (\n            local theIndex = rm.getClosestHit() --get the index of the closest hit by the ray\n            local theFace = rm.getHitFace theIndex --get the face index corresponding to that indexed hit\n            --append theFacesArray theFace --add to the face array to select the face...\n \n            --find the distance from the current verte to the hit point\n            local theFaceID = rm.getHitFace theIndex\n            local theFaceCenter = meshop.getFaceCenter $ theFaceID\n \n            local theDist = distance theFaceCenter thePos\n \n            append theColorArray theDist\n            --print theDist\n        )\n        else\n            format \"The Ray % Missed\\n\" v\n    )\n \n    --assign the vertex colors\n    local vMin = amin theColorArray\n    local vMax = amax theColorArray\n    for v = 1 to theGSMesh.numverts do --go through all verts of the Geosphere\n    (\n        local vColor = 255 - (UT_to255 vMin vMax theColorArray[v])\n        --print vColor\n        meshop.setVertColor theMesh 0 v ((color vColor vColor vColor))\n    )\n \n    --vertex color tuning\n    local vPaint = VertexPaint()\n    addModifier theMesh vPaint\n)\n \n--run\nglobal curMesh = $\nif(classof curMesh != Editable_mesh) then convertToMesh curMesh\naa_bakeMeshThickness curMesh\n \ncurMesh.showVertexColors = on\ncurMesh.vertexColorsShaded = off\ncurMesh.vertexColorType = 0<\/code><\/pre>\n\n\n\n<p>And the HLSL code to use this information is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">float4 sssColor = float4(0,0,0,0);\nif(g_sssEnable)\n{\n    float sssInterpolation = pow(max(dot(-IN.eyeVector, IN.LightVec.xyz), 0), 2);\n    sssColor = lerp(float4(0,0,0,1), g_SSSColor, sssInterpolation) * float4(IN.vertColor, 1) * g_sssMultiplier;\n}<\/code><\/pre>\n\n\n\n<p>Finally I simply add the sssColor to the output pixel.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">dinamically load .net assemblies in 3dsMax<\/h1>\n\n\n\n<p>April 10, 2012<\/p>\n\n\n\n<p>During intensive 3dsMax+C# development, a really annoyng issue is the blocking loading of .dll assemblies performed by 3dsMax.<br>The technique by Denis Trofimov solves the issue:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">assemblyPath = @\"\\\\aardolino\\aa_imageMosaic.dll\"\nassembly = (dotnetclass \"System.Reflection.Assembly\").Load ((dotnetclass \"System.IO.File\").ReadAllBytes assemblyPath)\nimgMosaic = dotNetObject  \"aa_imageMosaic_namespace.aa_imageMosaic_class\"\nimgMos.showForm()<\/code><\/pre>\n\n\n\n<p>More information here: <a href=\"http:\/\/forums.cgsociety.org\/showpost.php?p=6864094&amp;postcount=480\">http:\/\/forums.cgsociety.org\/showpost.php?p=6864094&amp;postcount=480<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Code over here: http:\/\/www.aardolino.com\/blog\/ or Playing Remedy\u2019s Alan Wake for Xbox, and feeling lost seeing its marvelous forest environment, wondering about how to procedurally animate trees and vegetation using vertex colors, the idea of SS&amp;F-SSS came out: use mesh thickness to modulate a SSS color. [Yes\u2026it\u2019s not related to trees and vegetations actually]I\u2019m confident that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3756,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1002],"tags":[],"class_list":["post-3754","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/10\/imagen-7.png?fit=1016%2C784&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9XJix-Yy","jetpack-related-posts":[{"id":1149,"url":"https:\/\/cocoalopez.com\/blog\/?p=1149","url_meta":{"origin":3754,"position":0},"title":"Realtime Nextgen Shader para 3ds Max","author":"cgmodeler","date":"April 9, 2012","format":false,"excerpt":"Dando la vuelta por la web, me encontr\u00e9 \u00e9ste shader gratuito para 3DS Max, realtime viewport, normal maps, soft texuring, soft shadows, etc... http:\/\/xoliulshader.com\/ M\u00e1s ejemplos en:\u00a0http:\/\/xoliulshader.com\/videos","rel":"","context":"In &quot;3d &amp; Design&quot;","block_context":{"text":"3d &amp; Design","link":"https:\/\/cocoalopez.com\/blog\/?cat=2"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2012\/04\/header_41.jpg?fit=920%2C245&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2012\/04\/header_41.jpg?fit=920%2C245&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2012\/04\/header_41.jpg?fit=920%2C245&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2012\/04\/header_41.jpg?fit=920%2C245&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3685,"url":"https:\/\/cocoalopez.com\/blog\/?p=3685","url_meta":{"origin":3754,"position":1},"title":"UI and Viewport performance lags or seems slow on fast multicore CPUs in 3ds Max","author":"cgmodeler","date":"September 21, 2022","format":false,"excerpt":"Found this thread for solving the sluggish UI on 3DS MAX. https:\/\/knowledge.autodesk.com\/support\/3ds-max\/troubleshooting\/caas\/sfdcarticles\/sfdcarticles\/3ds-Max-UI-lags-or-seems-sluggish-even-on-very-fast-multi-core-CPUs.html Issue: 3ds Max lags or shows a delay in performance, even on fast CPUs. This includes, but is not limited to Intel i9 and AMD 'Ryzen Threadrippers'.This includes clicking any area of the user interface or moving objects,\u2026","rel":"","context":"In &quot;Featured&quot;","block_context":{"text":"Featured","link":"https:\/\/cocoalopez.com\/blog\/?cat=1002"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/09\/imagen-3.png?fit=872%2C829&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/09\/imagen-3.png?fit=872%2C829&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/09\/imagen-3.png?fit=872%2C829&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/09\/imagen-3.png?fit=872%2C829&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":879,"url":"https:\/\/cocoalopez.com\/blog\/?p=879","url_meta":{"origin":3754,"position":2},"title":"Probando: Conexi\u00f3n entre 3DS MAX y Messiah","author":"cgmodeler","date":"November 13, 2011","format":false,"excerpt":"Por fin puedo usar la licencia que compr\u00e9 de Messiah Animate, estuve probando el Autorig para Luis y funciona bastante bien, habr\u00e1 que ver c\u00f3mo funciona el export de c\u00e1meras para animar en layout. Todo en tiempo real, se agrega un modificador al stack del mesh y autom\u00e1ticamente se abre\u2026","rel":"","context":"In &quot;3d &amp; Design&quot;","block_context":{"text":"3d &amp; Design","link":"https:\/\/cocoalopez.com\/blog\/?cat=2"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2011\/11\/MesMaxConnection.jpg?fit=1200%2C618&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2011\/11\/MesMaxConnection.jpg?fit=1200%2C618&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2011\/11\/MesMaxConnection.jpg?fit=1200%2C618&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2011\/11\/MesMaxConnection.jpg?fit=1200%2C618&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2011\/11\/MesMaxConnection.jpg?fit=1200%2C618&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4295,"url":"https:\/\/cocoalopez.com\/blog\/?p=4295","url_meta":{"origin":3754,"position":3},"title":"DECRYPT 3DS MAX Encrypted .mse Scripts","author":"cgmodeler","date":"March 17, 2024","format":false,"excerpt":"So it's been years that I've been using this utility and I thought I would share it with the world. You need the 3DS MAX.bms file to use the quickbms by Luigi Auriemma Here's the max.bms which you can also download from the site https:\/\/aluigi.altervista.org\/bms\/3dsmax.bms 3dsmax bmsDownload And you can\u2026","rel":"","context":"In &quot;Tips y Tutoriales&quot;","block_context":{"text":"Tips y Tutoriales","link":"https:\/\/cocoalopez.com\/blog\/?cat=31"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2024\/03\/image-2.png?fit=694%2C263&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2024\/03\/image-2.png?fit=694%2C263&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2024\/03\/image-2.png?fit=694%2C263&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":4627,"url":"https:\/\/cocoalopez.com\/blog\/?p=4627","url_meta":{"origin":3754,"position":4},"title":"Meet Cocoa Poly Tools for 3dsmax","author":"cgmodeler","date":"January 5, 2026","format":false,"excerpt":"Cocoa Poly Tools - DocumentationVersion: 1.0 (2026)Author: Edu Altamirano | cocoalopez.com -------------------------------------------------------------------------OVERVIEW-------------------------------------------------------------------------Cocoa Poly Tools is a compact floating toolbar for Autodesk 3ds Max designedto speed up polygon modeling tasks. It consolidates essential modifiers,advanced loop tools, and organic shaping brushes into a single interface. -------------------------------------------------------------------------INSTALLATION-------------------------------------------------------------------------1. Drag and drop the \"CocoaPolyTools.ms\" file\u2026","rel":"","context":"In &quot;Featured&quot;","block_context":{"text":"Featured","link":"https:\/\/cocoalopez.com\/blog\/?cat=1002"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2026\/01\/image-1-262x1024.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3714,"url":"https:\/\/cocoalopez.com\/blog\/?p=3714","url_meta":{"origin":3754,"position":5},"title":"CARPE (Tracking Gaze while watching films)","author":"cgmodeler","date":"September 30, 2022","format":false,"excerpt":"A very interesting project that tracks your gaze while watching films, a great way to assess the sight's location and if it corresponds to the intended point the DP or the Layout Artist defined as a focal point. https:\/\/vimeo.com\/19788132 More info here: THE DIEM PROJECT http:\/\/continuityboy.blogspot.com\/2011\/10\/smooth-pursuit-on-bbc-breakfast.html https:\/\/thediemproject.wordpress.com\/ http:\/\/www.davidbordwell.net\/blog\/2011\/02\/14\/watching-you-watch-there-will-be-blood\/","rel":"","context":"In &quot;Featured&quot;","block_context":{"text":"Featured","link":"https:\/\/cocoalopez.com\/blog\/?cat=1002"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/cocoalopez.com\/blog\/wp-content\/uploads\/2022\/09\/imagen-8.png?fit=500%2C229&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3754"}],"version-history":[{"count":2,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3754\/revisions"}],"predecessor-version":[{"id":4266,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3754\/revisions\/4266"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/3756"}],"wp:attachment":[{"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cocoalopez.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}