question

Roman Szczesny avatar image
Roman Szczesny asked ·

Implicit Surface - OSL Geo Shader

Hi there, does somebody know how to use the field shader channel in the implicit surface geo? Is it possible to create an implicit geo from an osl shader similar to the vectron workflow in octane? It should be working somehow but there is no documentation to be found how to use it. I would be really grateful if somebody could help me there. Thanks!

osl
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Mads Drøschler avatar image
Mads Drøschler answered ·


I had another look at your case.
Exported a known working OSL SDF construct to .ass
This is what the implicit construct in there returns.


implicit
{
 name /Arnold_Implicit001
 matrix
 1 0 0 0
 0 1 0 0
 0 0 1 0
 1020.7002 -0.308002472 0.579124928 1
 shader "/Material__266503"
 opaque on
 id 1485494943
 field "/Map__147"
 threshold 0
 samples 1
 solver "levelset"
 min -3.91188407 -2.97024989 0
 max 3.91188407 2.97024989 5
 step_size 3.4000001
 declare nodeRenderID constant INT
 nodeRenderID 65535
 declare gBufID constant INT
 gBufID 0
 declare nodeHandle constant INT
 nodeHandle 2
 declare wireColor constant RGB
 wireColor 0.603921592 0.603921592 0.898039222
 declare nodeName constant STRING
 nodeName "Arnold_Implicit001"
}

Also attached the procedural, you should be able to load it in houdini and see an implicit cage somewhere around scene center and to the side.

If you can, we just confirmed you can load and render implicit OSL structures.

So your mission is to conform to this.

---

So line 1
- Initialize "implicit"

line 9, in the implicit construct you attach the
- shader "/material__266503"

and more importantly line 12
- field "/map__147"




qwe.png (137.8 KiB)
implicit.ass (7.2 KiB)
1 comment Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Thank you very much! Yes the ass file is working fine. So it should be working somehow, but I still have no idea how to conform to the field shader channel. Frustratingly there is not a single example found on the internet of somebody using it. And most of the time when I load a costum shader houdini instantly crashes... Anybody here is using it? Your file reveals that you have the privilege to use the beta :) Is there also a beta for houdini 18? Maybe they have been improving the API for Implicit Surfaces. I am patiently waiting for the hydra delegate anyway or a working version for 18.

0 Likes 0 · ·
Mads Drøschler avatar image
Mads Drøschler answered ·

OSL Mandlebrot SDF traced against the Arnold Sky dome.


You would want to get a contact between this node and the implicit construct in houdini.
Now, I am not aware if such a thing already exsists or wether you need to fabricate a reciver node that translates the shader into an arnold implicit structure at render time.
Here is the actual Mandlebrot and a correctly formated output.

You see we source P to the map, we setup some rules for P so P conforms to the expression we parse P through ( the mandlebrot )

It could be anything in

vector map ( vector p )
{
// insert your favorite shape here
// boxes, chamfered boxes
// spheres, or spheres with lots of holes
// you can also smoothstep to get nice perfect morphing curvature surface ( that are animated and new topology needed for every frame ) that will never flicker or return flipped normals.....bonus
}

 void ry( output vector p, float a){  
     float c,s;
     vector q=p;  
      c = cos(a); s = sin(a);  
      p[0] = c * q[0] + s * q[2];  
      p[2] = -s * q[0] + c * q[2]; 
 }  

vector map(output vector p) {
    p = vector(p[0],p[2],p[1]);
    vector z = p;
    vector dz=vector(0.0);
    float power = 8.0;
    float r, theta, phi;
    float dr = 1.0;
    
    float t0 = 1.0;
    for(int i = 0; i < 7; ++i) {
        r = length(z);
        if(r > 2.0) continue;
        theta = atan(z[1] / z[0]);
        #ifdef phase_shift_on
        phi = asin(z[2] / r) + Time*0.1;
        #else
        phi = asin(z[2] / r);
        #endif
        
        dr = pow(r, power - 1.0) * dr * power + 1.0;
    
        r = pow(r, power);
        theta = theta * power;
        phi = phi * power;
        
        z = r * vector(cos(theta)*cos(phi), sin(theta)*cos(phi), sin(phi)) + p;
        
        t0 = min(t0, r);
    }
    return vector(0.5 * log(r) * r / dr, t0, 0.0);
}
   shader implicit(output vector field = 0) {
         field  = map(P);
      }      



qwe.jpg (137.4 KiB)
1 comment Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

And here is some pseudo code how we access and execute the SDF.
It may help if you need to fabricate a destination node Arnold can handle.

https://paste.ofcode.org/QAw3hcWTd7PUCjY4T3qeSY

1 Like 1 · ·
Mads Drøschler avatar image
Mads Drøschler answered ·

Im not a htoA person.

But Arnold renders OSL SDF implicit cases perfect.
I have done a million ( I havent, but have done a lot )
You need to exit the shader on a conformed Position, like an external funtion that defines the SDF shape and route the P in the main body through that function.

I can show some examples of known working OSL SDF constructs arnold can render as implicit surfaces if you want.
But on same time not entirely sure if that is needed, and if your issue is related to houdini exclusively.

1 comment Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Thank you very much for the swift answer. :)

Yes this would be exactly what I need! If you would show me an example I would be very grateful. What I want to try first is to realize the mandelbrot example that is listed in the arnold docs but with a sdf instead of a fog volume. It would be awesome if you have an example for that, but a hint how to do OSL SDF would be great as well. Just to know how to start because there is no Information on the web on how to proceed. It is not necessary that the example is houdini specific. I might be able to conform it to houdini.

0 Likes 0 · ·
Roman Szczesny avatar image
Roman Szczesny answered ·

Thank you very much! Unfortunately I did not get it to work yet. Here is a screenshot of the implicit surface tab set to custom:

or field shader:

If I plug in a standard volume shader with a displaced field ( like the OSL volume fractal ) nothing happens. This is how the shader network looks with a fog volume fractal:

In houdini shader network there are only these options for OUT_Material node. Did somebody who uses houdini with arnold got it actually to work? In the arnold answers post history there are 2 instances there they asked the same question, but they never got an answer... Thank you very much thought I really appreciated your effort.*Are you using 3ds max? Maya?


implicit-1.jpg (25.5 KiB)
2.jpg (24.2 KiB)
mandel-julia.png (443.6 KiB)
4 comments Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

using MAX.
I can see your last image is a volume where you wrap the fractal to the volume shape, you would need to do the same and send out implicit surface instead of volume.

I can wire a shader to a map slot on anything that has a map slot in max, not just shaders. So you need to link the actual osl code nodes output directly to a map slot, I would say and the map slot should be linked up into Arnolds "implicit" construct, so you need to initialize it.

1 Like 1 · ·

Like a sort of scriping language, where you can write houdini UI.
Then make a map slot, one you can drag a map or assign a map to.
Like a checker map could be assigned to all kinds of constucts in houdini I imagine, peoples size black means 1 meter tall person white means 2 meter tall person.
You need to construct and initialize Arnold so Arnold knows we are dealing with an implicit construct, derived from this OSL map.

1 Like 1 · ·

Try:


kick.exe -nodes

It will print a list of installed arnold nodes.
And you need to initialize the highlighted implicit node.


1 Like 1 · ·
ee.png (26.5 KiB)
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.