Jump to content
Sign in to follow this  
itriix

varying expression

Recommended Posts

I'm trying to use a delayed load shader to load a particle sim... I have four sims... So, I could have 4 geo nodes, each with a delayed load shader, each pointing to a different sim... But i feel like there should be a way to use only ONE delayed load shader, and point each of the 4 geo nodes to that single delayed load shader, and inside of the *file* parameter of the delayed load, use an expression that will use a particular sim based on the geo node.

It's a coke can that's turning into particles... the particle sims are named: coke_particles_tk01_1.$F4.bgeo, tk02_1, tk03_1, tk04_1...

I named the geo node: COKE_DELAYED_SHADER_1, 2, 3, and 4...

So i thought i could use the opdigits, to gather the "particle sim path" based on the the name of the geo node.

I tried to create a geometry file parameter on the geo node with an expression like this:

$HIP/sim/coke_particles_tk0`opdigits(".")`_1.$F4.bgeo

I thought I could then somehow use the opdigits in the delayed load shader file parameter but it doesn't seem to be right. just don't know what i should do then

I tried to use this expression in the delayed load shader file parameter:

chs("../../COKE_DELAYED_SHADER_`opdigits(".")`/parm")

i know this doesn't work, but not really sure how to go about it. Thoughts?

Thanks for the time

Jonathan

Edited by itriix

Share this post


Link to post
Share on other sites

I'm not sure what your real problem is but once you're in the expression language, it doesn't make sense to use backticks again. So maybe something like this:

chs("../../COKE_DELAYED_SHADER_" + opdigits(".") + "/parm")

Share this post


Link to post
Share on other sites

Hi Edward,

Sorry about that, i'll try and explain more clearly. I want to use only one delayed load shader for ALL of my "particle geo caches"... instead of one delayed load shader PER particle geo cache... I feel it would be "cleaner" and more efficient to have ONE delayed load shader that's file parameter uses an expression to get the FILE PATH to the cache it should read in. This expression would point to a spare file parameter on the GEO NODE that uses the delayed load shader. The spare file parameter would also use an expression that makes use of the opdigits function, in order to POINT to a different particle cache file. So in turn, each GEO NODE, would point to a different cache, but only ONE single Delayed Load Shader would need to be used, for ALL of the geo nodes, instead of say 20 delayed load shaders if there were say 20 different geo nodes.

So, I created a spare FILE parameter on my COKE_DELAYED_SHADER_1 geometry node, Inside it i used this expression:

$HIP/cache/coke0`opdigits(".")`/coke_particles_0`opdigits(".")`.$F4.bgeo

I then pointed all of my geo nodes to the SAME delayed load shader.

In that delayed load shader, i set the file parameter to you're new suggestion:

`chs("../../COKE_DELAYED_SHADER_" + opdigits(".") + "/parm")`

but nothing is coming up in my render and i'm getting a "BAD PARAMETER REFERENCE WARNING" on the delayed load shader node. Even if it worked, i still see a problem with my current attempt. in the delayed load shader's expression, i'm wrongly using the opdigits i think... My intentions were to attempt to get the DIGIT of the GEO NODE that is USING the delayed load shader, but i think it's just going to return the digit of the actual delayed load shader itself. If I have four geo nodes:

COKE_DELAYED_SHADER_1, COKE_DELAYED_SHADER_2, COKE_DELAYED_SHADER_3 and COKE_DELAYED_SHADER_4... each of them have a spare file parameter called: parm that uses an expression that makes use of the opdigits function, to point to a particular particle cache... So COKE_DELAYED_SHADER_1 's file param points to coke_particles_01 sequence, and COKE_DELAYED_SHADER_2 points to coke_particles_02, and so on... If each of these GEO NODES all just have a delayed load shader called "dlshader" applied to them, i want "dlshader" to have an expression in it's file parameter, that can make use of WHAT GEO NODE is being used, and point to it's spare file param. that way i can use just one delayed load shader for all of the geo nodes instead of many delayed load shaders, ONE FOR EACH of the geo nodes. This is possible?

I'm supplying pics of these two scenarios.

Thanks as always Edward!

Jonathan

coke_can_path.tiff

delayed_load_refpath.tiff

Edited by itriix

Share this post


Link to post
Share on other sites

Thanks! It took a little "sherlock holmes" action but I got it! I'm a bit curious as to WHY the way that works... WORKS... Because in fact, I tried many variations similar to this but not the same. For example, when I read the "delayed load shader" help a few times before, it specifically states that to use it, you should select your GEO node, Go to: Render Tab --> Geometry SubTab --> Procedural Shader, and point to your delayed load shader here... but in fact the way that ended up working, was to NOT point to the delayed load shader here, but instead, turn the delayed load shader into a MATERIAL, and then use the MATERIAL tab of the Geo node to point to that material, and then use the pulldown menu next to the material path, and do: select and create local material parameters, and use THAT new parameter to create the material ovverride.

My journey: (if not interested, please just skip down to the few questions i have at the end, *they are numbered*)

So after trying a few things, and not getting it to work, you're suggestion had me reread all the help files. It emphasized to create a material parameter with the same "name" as the parameter you're trying to override on the material. So, I had used the "edit parameter" interface, created a parameter with the same name as the "file" param on the delayed load shader... But still would not get anything to render correctly. So then, I was persistent and just decided to try every combination of every single thing I could try. AND, learned something else new by doing this... I never noticed there was a pulldown menu on the "MATERIAL" tab of the "GEO NODE"... after discovering that, i saw it said: select and create local material parameters... so i tried that, but "like i said before", i had already hand created a parameter, so it through a warning saying the parameter already existed! hmmm... So, I also noticed that to be able to USE the MATERIAL TAB, the "delayed load shader" needed to be turned into a MATERIAL... so i went to SHOPS, selected it, HIT SHIFT-C, to make it into a material, went back to the GEO NODE --> Material Tab. Pointed to the "new material that encompassed the delayed load", and then tried to render! Still nothing. Hmmm interesting, WELL, then I tried DELETING my hand created parameter, and using the: select and create local material parameter... Then setting up my expression inside THERE, and BAM it works!... I then figured I should try removing the "delayed load shader" that i originally pointed to that was still on the Procedrual Shader Parameter in the Render - Geometry Tab, and then tried to render, and VOILA it still works! AWESOME! I'm so happy!

1. Anyways, i guess there were a few things going on that through me off. Like, something must be happening behind the scenes by using the "select and create material parameters" instead of just being able to "create a parameter" using the edit parameter interface. because that way didn't work.

2. Also, just for my own understanding, is the "Render Tab -- Geometry SubTab -- Procedural Shader path, only there for "simplicity" sake, if you don't actually NEED a MATERIAL, and are just using a Shader, being that the help file says this is where you point to your delayed load shader, but in fact, to get everything to work, i DID NOT do that, and ended up just using the material tab instead!

3. To make sure i'm not missing something, is it true that I CANNOT do this override of the parameter, without using the MATERIAL tab of the geo node and turning my delayed load shader into a material? It cannot be done on a shader level? Where instead of using the material tab, I just use the "procedural shader" path, pointing to the delayed load shader, and use some kind of override on this level? Or is that the point, overrides can only be done on a material level?

4. Also, the reason I went through all this is because I felt like it would be "more efficient" to only use ONE shader, that references the different files, instead of say 4... or 1000! I'm not too sure the way things work though, and if this IS indeed more efficient or if it's really not...

Thanks so much,

I really appreciate you pointing me in the right direction there,

Jonathan

Edited by itriix

Share this post


Link to post
Share on other sites

Well, you've already figured out this more than I've ever attempted so someone else who knows more will have to step in. :)

As for the help, I think it was doing it for a specific case and not for what you had in mind per se.

Share this post


Link to post
Share on other sites

hi!

Can you please post a hip file? or the expression you used to make it work?

I tried some time ago to do the exact same thing, but for time reasons i had to leave it in stand by :)

thank you for your help!

Share this post


Link to post
Share on other sites

Edward,

I have to admit that made me feel honored! (even if it wasn't intended as such) :ph34r:

Menoz,

Hello there. Here is a .zip with everything you need. To see it in action, render out the "geometry rop" nodes first. Once that's finished, just render from the mantra_render node. i also made a sticky with and explanation. I hope it works for you. Let me know if you have any questions.

Cheers,

Jonathan

delayed_load_odForce.zip

Edited by itriix

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×