Jump to content

varying expression


itriix

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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...