Hello,
The visualization I want to achieve is to color my sphere volume shells by shells, which was successful by using a color node and using programming to modify its parameters; then, I want to cut a quater or a half of the sphere (it was achieved by Vexpression shown in screenshot 1) so that the shells of color contrast can be more obvious to be seen, like seeing a cross section.
However, what I noticed was that the color seems to be set again based on the new volume obtained after removing a part of the sphere by using volume wrangle node. This was noticed from the second screenshot attached, there should be half of the shells with bright color just like the color ramp gradient shows.
Could someone provide another way to achieve my visualization?
Thanks in advance!!
Found 10 posts.
Search results Show results as topic list.
Houdini Lounge » give color to a volume and remove a part of the volume
- jingyukan
- 10 posts
- Offline
Houdini for Realtime » remove 1/4 sphere volume with VEX code
- jingyukan
- 10 posts
- Offline
mestela
One of no doubt many ways:if (@P.z>0 && @P.y>0){ @density*=1; } else { @density=0; }
Thanks so much!
I remembered I tried this logic before, my syntax might be wrong
Houdini for Realtime » remove 1/4 sphere volume with VEX code
- jingyukan
- 10 posts
- Offline
Hello,
I preciously cut my sphere volume in half and let one half disappear using Vexpression like “f@density *= v@P.x<0”, but what if I want its 1/4 to be removed?
I tried to use expression like “f@density -= f@density *v@P.z<0 *v@P.x<0;”, but it did not work at all.
Hope someone can provide another way, thanks!
I preciously cut my sphere volume in half and let one half disappear using Vexpression like “f@density *= v@P.x<0”, but what if I want its 1/4 to be removed?
I tried to use expression like “f@density -= f@density *v@P.z<0 *v@P.x<0;”, but it did not work at all.
Hope someone can provide another way, thanks!
Houdini Lounge » Using python code to set color parameter with expression
- jingyukan
- 10 posts
- Offline
Hello, I have a question about scripting the code that can be used to set color attributes in color node with an expression like I did in the screenshot, I guess the syntax is not correct to set each color point attribute using “%d”%(j).
What I want to achieve is to give each blue attribute of my 200 color points an expression like “point(“../attribwrangle”, $F, “waterCd#”, 0)” where # are indices of all my created attributes start from 0 to 199
Hope someone could give me a hint!
Thanks in advance!
What I want to achieve is to give each blue attribute of my 200 color points an expression like “point(“../attribwrangle”, $F, “waterCd#”, 0)” where # are indices of all my created attributes start from 0 to 199
Hope someone could give me a hint!
Thanks in advance!
Houdini Indie and Apprentice » using python to modify/control color node and bounding box
- jingyukan
- 10 posts
- Offline
tamte
1. don't use Python SOP to modify UI of other nodes, as that runs the code every time it cooks and you probably want to set your ramp just once, use Python Source Editor, Shelf Tool, Python Shell, Parameret Callback script, …. instead
but to populate ramp with 200 random colors you can for example do thisimport hou import numpy ramp = hou.parm('/obj/geo1/color/ramp') count = 200 ramp.set(count) parms = ramp.multiParmInstances() for i in range(0, len(parms), 5): color = numpy.random.rand(3) parms[i].set( i / 5.0 / count ) parms[i+1].set(color[0]) parms[i+2].set(color[1]) parms[i+3].set(color[2]) parms[i+4].set(0)
2. you can for example clear the density voxel values in Volume Wranglef@density *= v@P.x < 0;
Hello, thanks for helping!
The volume wrangle works well; for color ramp, I modified your coding example, it works for most part, but there is only one problem that I need to give one of the parameter an expression like what I did in screenshot attached. I noticed it did not work like other node's parameter controlled by python. The attribute I need the blue color parameter to read is attribute “waterCd#” with index starts from 0 to 199.
Hope you could teach me the correct syntax~
Many thanks!
By the way, may I ask where I could watch more tutorials about programming in Houdini to simulate scientific visualization, I found that the resource for scientific simulation with Houdini was not really rich so far~
Houdini Indie and Apprentice » using python to modify/control color node and bounding box
- jingyukan
- 10 posts
- Offline
Hello, I got two specific questions in simulation right now, as they were described in title.
First, I want to use python node to program a few lines of statement that could add color points on the ramp of my color nodes, since I need to add 200 points in order to give my geometry layers of different colors.
(I only know the syntax of how to set node's attribute values with Python, but I did not find out the syntax that can tell the node automatically add points)
Also, as my first screenshot shows, I want to know how to set values to color vector, since color parameter's name is “rampcr#rampgr#rampbr#”, I don't know how to syntax that with values and expressions.
The second question is about generating a bounding box in order to delete exactly half of my volume, but I want the effect operated in the end of my network, because I want the color be set well(i.e. color changes from shell to shell of my spherical volume), and then cut it half, make the cross section of my spherical volume be seen, so that the rings of different colors could be seen more obviously~
I used a delete node as the second screenshot shows, but it did not work, it seems all my volume was disappeared, the whole volume was ghosted in the scene so that you can see what I constructed. I don't know if I set something wrong or I should use another node to achieve my final effect?
It is ok if you can only solve one of my questions, I would be grateful. Thanks a lot in advance!
First, I want to use python node to program a few lines of statement that could add color points on the ramp of my color nodes, since I need to add 200 points in order to give my geometry layers of different colors.
(I only know the syntax of how to set node's attribute values with Python, but I did not find out the syntax that can tell the node automatically add points)
Also, as my first screenshot shows, I want to know how to set values to color vector, since color parameter's name is “rampcr#rampgr#rampbr#”, I don't know how to syntax that with values and expressions.
The second question is about generating a bounding box in order to delete exactly half of my volume, but I want the effect operated in the end of my network, because I want the color be set well(i.e. color changes from shell to shell of my spherical volume), and then cut it half, make the cross section of my spherical volume be seen, so that the rings of different colors could be seen more obviously~
I used a delete node as the second screenshot shows, but it did not work, it seems all my volume was disappeared, the whole volume was ghosted in the scene so that you can see what I constructed. I don't know if I set something wrong or I should use another node to achieve my final effect?
It is ok if you can only solve one of my questions, I would be grateful. Thanks a lot in advance!
Edited by jingyukan - 2020年6月10日 16:07:57
Technical Discussion » Loop through inputs attributes in VEX
- jingyukan
- 10 posts
- Offline
mestela
Looking at your screenshot there, this is one way to convert that into a loop:string src, dest, prefix, newprefix; int range; float value, min, max; prefix = 'water_conc'; newprefix = 'waterCd'; range = 8; min = 264; max = 142; for (int i=0; i<=range; i++) { src = prefix+itoa(i); // construct the source attribute name dest = newprefix+itoa(i); // construct the destination attribute name value = point(0,src,@ptnum); // read the value value= fit(value, min,max,0,1); // fit setpointattrib(0,dest,@ptnum,value); // set the value }
Thanks so much!!
Technical Discussion » Loop through inputs attributes in VEX
- jingyukan
- 10 posts
- Offline
kahuna031
Sounds like you can put the attributes in a string with a chs() expression, split that to an array, loop over the attributes:
foreach (string attribName; splitArray){
point (0, attribName, @ptnum)
}
Edit: missed the nWeight attribute.
Do a for loop instead.
for (int i =1; i <nWeight+1;i++){
point (0,“weight”+itoa (i), @ptnum)
}
Hello, I have a similar problem, since I am quite new to vex language, would you mid be more specific? Like I have 200 columns in geometry spreadsheet as attributes, and I want to take each column with name “water_conc0”,“water_conc1”,“water_conc2”… and fit each data into range 0 - 1 using fit01() function, so that I could get 200 columns of 0 - 1 data.
But I don't know how to use the for loop to achieve this.
Thanks in advance!
This iterated code could illustrate what I want to achieve~
Edited by jingyukan - 2020年6月8日 17:05:06
Technical Discussion » simulate effect based on imported data
- jingyukan
- 10 posts
- Offline
Hello~ Is there anyone could help me about some basic manipulation question? I'm a newbie in Houdini, right now working on a undergraduate summer research simulation~
I would like to simulate a simple droplet growth and shrink process. I got a data table which has time column and radius column, I've import the data into Houdini in “tableimport” node. And I also have achieved to manipulate the sphere's radius to change per frame based on my data.
But what I stuck on how to manipulate each frame time differently so that the change rate in radius could match the time data from the experiment.
I would like to simulate a simple droplet growth and shrink process. I got a data table which has time column and radius column, I've import the data into Houdini in “tableimport” node. And I also have achieved to manipulate the sphere's radius to change per frame based on my data.
But what I stuck on how to manipulate each frame time differently so that the change rate in radius could match the time data from the experiment.
Technical Discussion » customize inconsistent time increment per frame
- jingyukan
- 10 posts
- Offline
Hello, I am doing a scientific process simulation.
What I want to achieve is to simulate with data table from the experiment.
For example, I got a time column and a radius column, right now, I have imported my data file into Houdini, and have manipulate to simulate the radius change as frame goes forward.
However, I would like to know how can I manipulate the real time increment per frame to be the data I imported, so that the radius change rate corresponds exactly to the time my experiment obtained.
Thanks!
What I want to achieve is to simulate with data table from the experiment.
For example, I got a time column and a radius column, right now, I have imported my data file into Houdini, and have manipulate to simulate the radius change as frame goes forward.
However, I would like to know how can I manipulate the real time increment per frame to be the data I imported, so that the radius change rate corresponds exactly to the time my experiment obtained.
Thanks!
-
- Quick Links