| Item | Quantity | Price |
|---|
| Your cart is empty. Check out our collection of 3d models! |
Prices in:
Clear Cart
Well elementary you can not but a plane is trivial so particle sampler can do it as you dont need a projection in this case. Thing is maya is missing one node that is the 3d sampler. You can go the tedious route and use colorAtPoint but thas slow.
You should really make a node for this if you need it its sortof trivial if youve ever used maya api.
example scene follows drop in script editor and execute (investigate the graph):
1 | proc string createTurncatedPyramid(){ |
Oh one thing the noise maya sees and the noise mentalray generates is not the same
Interesting, thanks for the script. I'm attaching a playblast of its output for the audience.
I see that you're using the arrayMapper node to return the value of a texture at any point given its UV coordinates, and then connecting that to a custom attribute called returnValuePP on a particle system. So in this case, since you're using a particle grid, which comes with its own UV mapping, that solves the problem of getting the UV coordinates.
So if you knew the origin of a projection's UV map, theoretically with a few math nodes you could get the UV coordinates of any point in space without needing an intermediate object (like a nurbs plane) and a bunch of colorAtPoint commands. Then you could feed that back into an arrayMapper and connect the output to whatever you liked... Does this sound reasonable?
I've just found another example of your technique here, with in-depth explanations of each step, for those who are interested...
http://www.romainrico.com/archives/277
Using a closestPointOnMesh node I can get the UV coordinates of a given point (I can also do it with a samplerInfo node), but the arrayMapper node's uValuePP and vValuePP only accept double arrays, and the CPOM and samplerInfo outputs are floats. Is there some way besides an expression to connect these two, maybe through some kind of datatype conversion? Will that work the way I imagine? Of course the arrayMapper's outColorPP is named that because it assumes it will be used with particles, but is that necessary?
Continuing the search, I've found a cutsom Python plugin by Pascal Loef at Double Negative called sppl_colorAtPointNode:
http://forums.cgsociety.org/showpost.php?p=4956975&postcount=8
It's a wrapper of MRenderUtil::sampleShadingNetwork, and rather slow, but it does the job. It also comes with some test scripts -- I had to modify them a bit to get them to work, though I may have installed them wrong... in the 2D test script there's a call to pypl_colorAtPoint() that I believe should be sppl_colorAtPoint(). At any rate, when I changed it and ran the test, this is what I get:
But again, it is rather slow compared to Joojaa's particle method. Isn't there any way to get to the color value directly using an arrayMapper without using particles?
>> Then you could feed that back into an arrayMapper and connect the output to whatever you liked... Does this sound reasonable?
Yes but you could use the particle expression to do that with minimal overhead. And less work for the sampler info to calculate.
>> http://www.romainrico.com/archives/277
Yes it just so happens that this is the remade version of tutorial (the script you see above is a partial rewrite of a script i sent him when i suggested a faster solution he just reworked it into the tutorial). ;) The original used color at point.
>> Isn't there any way to get to the color value directly using an arrayMapper without using particles?
Well see thing is the reason MRenderUtil::sampleShadingNetwork, becomes slow is that you call it once for everything in a normal node network. But see, the act of calling one MRenderUtil::sampleShadingNetwork is about as slow as calling a 100 separate calls in ONE call to MRenderUtil::sampleShadingNetwork. So the overhead iof initializing MRenderUtil::sampleShadingNetwork is pretty enormous. So you should get some speed gains by piping many outputs form one node.
Second reason:
particles are ordered as a data structure much more optimally for updating, so theres some net gain to this and the instancer drawing.
But theres no real reason why you can not use array mapper with normal objects
PS: ok i get thet you want to use aprojection but for your demo theres not much point as its just waste of time, you can do the same with the uv placement node and its heaps faster.
Okay, I'm convinced -- thanks very much, Joojaa. One last question: can this be done with particles at arbitrary locations that aren't in a particle grid, maybe using a UV placement node as the UV scale reference? That's the reason I'd been trying to avoid particles, I want to be able to sample arbitrary points in space.
>> with particles at arbitrary locations that aren't in a particle grid
yes off course. Your just limited to 2 dimensional sampling.*
*alas you CAN do 3d sampling with a 2d sampler, as you can pack coordinates withing a single double but dangerous but if you know what your doing and know the constraints then why not. However since your doing a projection just calcualte a projection for the particles UV value each frame.
How can I sample the value of a projection, 2D or 3D, in space? The projection's outColor is the value at 0,0 only.
This is essentially the same question as this one from 2002, but the answer isn't clear, possibly because of the forum conversion --
http://www.creativecrash.com/forums/animation/topics/animating-objects-with-texture-
Here's an example:
I've connected the projection outColor to each object's scale, but the objects only get the value at the texture's UV origin.