Community
3ds Max Shading, Lighting and Rendering
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max materials topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OSL Object related shaders

7 REPLIES 7
Reply
Message 1 of 8
MysticLtd
1023 Views, 7 Replies

OSL Object related shaders

Hello! 🙂

 

I wanted to ask for some object related OSL shaders.

 

1. A kind of "VRayDistacnceTex" as OSL map. I know there is allready the "TextureObjMask" map in 3dsmax, but it's very limited and not OSL. So real usecases are pretty rare.

 

2. An OSL rewirte of the "ShapeMap" where you can convert closed spline objects to texture maps. Even with all its functions but with a very important addition: A falloff value for smoothly fading out the shapes edges.

 

3. Trail OSL map: When you move an object along the surface of the shaded object, the shader sould draw a trail from the objects trajectory. With options to manage dissipation speed, shrink speed (so that the trail becomes thinner towards the end) etc. Maybe this trails map could be a component of the map I requested in point 1.

 

4. Impact OSL map: When you shoot particles or objects towards a surface and they hit it or are close to it in a given radius or distance, the shader sould automatically draw spreading ringwaves outwards from the impact center. Possibly it could build up like this: First it is a dot then it becomes a disc and then it morphs to the ringwave shape which is spreading outwards along the shaded surface and disappears smoothly after a given time. Some noise controls would be nice as well so that some variation could be applied to the rings.

 

Greetings :)!

7 REPLIES 7
Message 2 of 8
madsd
in reply to: MysticLtd

1. it's possible but we need a bit of backend upgrades before it gets speedy.

 

However, if we keep everything shade side, we can do anything, but we dont have a way currently to easily hook up the radar, we have to go through hoops and .xml and parse things around which makes it very ugly but working.
So need some updates behind the curtain before this can be simplified.

 

2. We need a secondary buffer for this to happen in the simple way, code wise. We can like in 2. parse things in via .xml and rebuild the vector shape, when we rebuild the vector shape in the shader, we can do things you would not dream was possible, but again, its "ugly" to setup currently.

 

3. This requires an additional buffer, this has been requested for some time by myself, directly to Zap, so he very much knows I want this. If I get a multibuffer construct, everything you have seen around OSL right now is a drop in the ocean in terms of effects and shaders we would be able to do ( realtime fluids is dead simple to write shaders for with multiple buffers, and erosion, all those things )

4. I already wrote an OSL rain map, long time ago. The problem technically is to parse the incoming data structure in a simple way to the shader, but its possible to do, but again, in a semi ugly way technically speaking. However, there might be some new data structure solutions coming our way in the future that will simplify the process.

 

 

Message 3 of 8
MysticLtd
in reply to: madsd

So without the data structure imporvements, the backend upgrades and the extra buffers that you mentioned, it would just be possible in the "ugly" way, like you say? So for me that would be enough to give it a try.

 

I fear that waiting for the data structure improvements and extra buffers would take an unforseeable long time? So I would say its better to have this "ugly" shaders until then.

 

What do you think?

Message 4 of 8
madsd
in reply to: MysticLtd

I'll give it some thought, we already have tests going,  but it needs improvements ( the work around )
No ETA, but as soon as I get something going, Ill let you know.

 

Message 5 of 8
MysticLtd
in reply to: madsd

I'm not familiar with developing OSL shaders, so I didn't have any idea about what it means to build one. So what would you say is the normal avarage development duration for a new OSL shader? Just that I can get an idea.

Message 6 of 8
madsd
in reply to: MysticLtd

It's very difficult to say exactly.

 

I made a facebook group called OSL Shaders, and a week ago or so, a shading artist asked about, how to make a directional mask for example, it took 5 minutes to make 4 variants doing the same thing.

 

Other stuff, can take some weeks, you chip away small section in the code, some stuff needs research and some failed attempts before you get the results you want, was looking for.

 

It took me a good 3 days of research for example to get Lumniosity blending going so I could write an albedo texture generator in OSL.

 

Other stuff, just write on the fly, done in under 1 hour, really depends.

 

 

Message 7 of 8
madsd
in reply to: MysticLtd

The absolute best way to start is to make a material, take some of the "math" shaders...lets say 3-5 of them. make some kind of shading with them.

 

Then keep that material and a refference object its on.

Dublicate the object and material, but leave out all shading nodes.

 

Then start a new empty OSL shader, and start to migrate the code from the 3-5 nodes into 1 single OSL node.

Thsi forces you to read and understand the shader code on the basic level.

 

There are typically ui entries, and actual code, you can copy and paste code from the nodes to the single node, but only copy past the relevant code.

 

shader add

(

float A = 1,

float B = 3,

float output  Out = 0,

)

{

 

Out = A+B;

 

}

 

 

 

----

 

This is an add node, now all you need to copy out, is the last line, and then put the A and B inside the { } instead of ()

Build your shader up systematically.

Message 8 of 8
MysticLtd
in reply to: madsd

Thanks for your detailed and passionated answers and the quick look into developing practice!

 

Please don't get me wrong, I don't want to start writing OSL shaders by myself. I'm just an artist looking for some OSL shaders, because I considered to move my shading workflow more or completely in the OSL direction. At the moment it seems that the pool of OSL shaders is still too patchy in comparison to all that legacy and 3rd party plugin maps, but it seems to be getting better (thanks to dedicated people like you).

 

I joined the facebook group you mentioned and will have a look at it from time to time. My impression is, that there are many OSL shaders out there and many places to get OSL shaders from. What I miss is a bit of an overview of all that many and different OSL hosting spaces. But I have to browse through a little bit more. Its quite interesting :)!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report