Archived post by goldfarb

OK Nerds…I’ve refreshed my github knowledge and made a ‘repo’ as the kids call it, github.com/mgoldfarb/Rigging-Utils

there is a bunch of crap in there as I just grabbed what I had currently all of them need to be cleaned up and have error checking, proper docs/tool tips etc but there are some handy things in there and they’re all pretty simple so you can see how they can be improved

Archived post by jake rice

Curve Roll-Up WIP for some esoteric art bullshit i want to make. Big thanks to @Skippy for his dank popcorn file which is the core of this whole system

I posted it in effects, but it might be good to post it here with the gif as well, this is the example project file and OTL

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/Rollup_Gif.gif
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/Curve_Rotations_v02.zip

Archived post by Wyeth

Good timing Luiz!

OK, draw calls. First off, the conversation is somewhat meaningless without knowing what target hardware we’re looking at, so this will all just be generalities. A draw call is basically the CPU saying to the GPU “Hey, I know the general state of the following set of triangles, make them”. It has to do with the type of things you’re drawing, the buffer to draw them to, their material state (is it opaque, translucent, whatever), and other such nonsense. All draw calls are not created equal. Drawing 100 objects with an identical material is cheaper than drawing 100 objects with disparate materials, because there is a renderer state change in between each draw call that takes time to change. In broad strokes, though, there’s little difference between a single object with 100 materials, vs. 100 separate objects. However, 100 objects with an identical material will be significantly less expensive than 100 objects with varying render states.
The “size” of the draw call matters. There is a fixed overhead to how much it costs to ask the driver to do work. Submitting a single draw call for 3 vertices means that the GPU is basically doing almost nothing, in essence stalled waiting for the CPU to submit its commands, stack the draw calls into a command buffer, all that stuff. The “sweet spot” is different on every platform but a broad, completely out of the ass generality depending on hardware is that there is generally little difference between asking the GPU to draw one triangle or 10,000, as the time to submit the draw calls is slower than any work the GPU would ever do. On modern hardware, that number might even be 100,000. Breaking up a mesh to increase CPU burden at the expense of GPU work is rarely a win, within reason (depending on your total scene budget and hardware).

One thing that’s unintuitive is that, in the case of dynamic lighting or shadowing, most things in Unreal are actually drawn three separate times in the render pipeline. Once to determine early Z (Can I abandon work on all these pixels entirely by deciding if I can discard them early in the pipe), once to render the object itself, then a third time to render to a shadow buffer that’s projected for dynamic shadows. That’s why if you type “stat RHI” (the platform independent implementation which talks to all the various graphics APIS) you will see your draw call number go down by 3 if you delete a single tree or whatever.
The big thing to understand is that depending on either how slow your CPU is, or at how many hertz you render at, draw calls are almost always your bottleneck in some form or another. On our first iphone demo, given the state of the performance of the driver and CPU speed on that device, we basically got 50 to 100 draw calls per scene, so combining assets was paramount. On Robo Recall, we had a reasonable GPU as a minimum spec, and a pretty poor CPU as a minimum spec, so draw calls were also absolutely crucial. We used LODs extensively that would take an expensive building with 4-8 material IDs down to one at a near LOD, just to minimize draw calls. We stayed around 1500 or less at all times, mostly because the GPU was happy to render a few million vertices (1-2million) but the time it took the CPU to do the draw call work absolutely was the bottleneck.

On a modern blazing fast I7, you might be able to submit 5k or 10k draw calls in that time timeframe, and then render 20 or 40 million triangles on a titan, and neither really cares. There’s a huge delta out there but draw calls are typically more of a problem than triangle throughput. Again, caveats abound and every platform is different.
Another piece of the pie is occlusion culling. Early on in the pipeline, the CPU compares bounding boxes to decide whether objects are completely covered by other ones. This is known as occlusion culling, and is determined solely by object bounds which are generally owned by the CPU. This is an option to discard work before it ever even makes it to the command buffer (the list of draw calls), which is ideal, and so is quite important for performance as it’s a “pre draw call” optimization. Lots of small objects, IF they tend to occlude each other, can be valuable, but it’s something to be profiled. In the case of a small room full of books, rarely would a book occlude another book, and so the optimization is lost.

In general, when thinking about optimization your thought process is:
– do objects occlude each other, combine accordingly if not – at a distance, is it valuable to submit multiple draw calls for different material states, or can I combine them into a single material state to make the draw call more efficient from far away, since the difference in render state (cloth vs. opaque vs. masked or whatever) matters less at distance – am I submitting a reasonable number of vertices that all have the same material or render state, if not, should I combine them – at a distance am I appropriately drawing the minimum number of vertices needed to maintain silhouette, and not a vertex more, ensuring that the GPU is always in sync or ahead of the CPU and not waiting on draw submissions? – what’s my total vertex count? Am I exceeding the comfort zone of my minimum hardware spec with regards to total vertex throughput?
In the case of a small room, at a VR min spec (low end i5, nvidia 960) I’d be OK with about a thousand draw calls, and maybe 1.5 million triangles. After that, it’s all profiling and measuring time.
Everything I just wrote is full of caveats and absolutely and completely wrong depending on what your target platform is. The only real way to proceed is try shit and when it’s too slow, figure out why.

Archived post by TOADSTORM

Hey all, after seeing lots and lots of similar questions on a few Houdini discords about how to vary copies in the Copy SOP, I wrote a terribly long explanation of how to manipulate orientation and instancing using template attributes, matrices, for-each loops, compile blocks, and some other tricks with packed disk primitives, with a .hip file at the end. Might help some newer or intermediate users. Post is here: www.toadstorm.com/blog/?p=493

Archived post by Lcrs

@Lorne I guess you saw matt/matte/dave’s one above but I dug out the hermite animation interpolator I did… it uses v from the points instead of the two extra timeshifts and because it has explicit tangents you can scale them with the damp parm to make it less curvy. if you use central difference in a trail to calc v and damp=1 it’s actually identical to the catmull-rom one… or you can use foward/backward difference to have it over/undershoot on the corners. cubic splines folks!

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/catmull_rom_hermite_interp.hipnc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/catmull_rom_hermite_interp_screenshot.png

Archived post by jake rice

i finally had some free time after all this moving craziness and since weve been talking so much about discrete operators, here’s my stab at the laplace-beltrami operator :smiley:

based off this paper: http://www.cs.princeton.edu/courses/archive/fall10/cos526/papers/sorkine05.pdf

hopefully my comments make sense 😮

I really need friends. like wtf am i doing with my weekends :C also theres a little bonus raytracing demo in there cuz i was explaining the basics to my roommate.

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/JR_Laplacian_v001.hip

Petz talks about application of maths concepts

There was some discussion about the best way to skim over maths papers, get familiar with the terminology, and apply that to cg. Petz gave a very thorough and practical breakdown of how to approach this:

but as you already know, personally i think it’s important to get an intuition about all these things before you start implementing it. the equation is not important and neither is the implementation. what is important is a general understanding of what such an operator does and what it means conceptually and geometrically. if i ask you what the laplace is and what it does, for example, and you tell me it’s the divergence of the gradient, then yes that’s true. that’s the definition but no explanation. and if you can’t explain it in your own words you don’t understand it no matter if you finally found an implementation or not. and if you want to learn about all this, i really think it’s important to understand it on a conceptual level first. there’s khan academy, there’s 3blue1brown and many more resources which can teach you this. but you have to start at the beginning and not at the end. that’s why i told you it might be a good idea trying to explain things to someone who does know nothing about math or even 3d because that is a perfect way to get a better understanding for yourself. skimming through dozens of papers and referencing arbitrary math stuff won’t help you. just my 2 cents …
anyway, back to your question:
basic understanding is all! let’s take again the laplace on a surface. conceptually it tells you the difference between a point on this surface and its surrounding. geometrically it can be visualized as sampling an infinitesimal geodesic circle around p. if you average these sample values and calculate the difference to the value at p, you have the laplace. let’s now say these values represent temperature as in the heat equation. the laplace tells you if the temperature of the surrounding is above or below the temperature at p. if it’s above, p is “heating up” and if it’s below, p is “cooling down”. nothing fancy and i’m pretty sure everybody has done something like this once in a sopSolver. now, the problem is that this is how the laplace works in a perfect world on a smooth suface.
in houdini, however, we are working on meshes. more precisely, mainly on quadrilateral or triangular meshes. usually we want to apply all the differential operators and whatnot on triangles since they are easier to work with for a number of reasons. quads are the worst! what you mean as “quads” are regular 2d or 3d grids which are very different to quadrilateral meshes.
well, how do we compute the laplace on a mesh. conceptually it is exactly the same but since the mesh is just a approximation to the surface we can also just compute an approximation to the laplace. again, we could just sample a small circle around p but for triangles this would not make much sense. instead we use the points in the surrounding of p we already have, in other words, we use the neighbouring points.

but here’s the problem: these points are not on a geodesic circle around p. their difference to p and their distribution around p is most likely not regular and therefore we have to compensate for these irregularities by using different weights. “conceptually”, however, you could also try to subdivide the mesh several times and then again sample the subdivided mesh on a small circle around p. that’s not an accurate solution but it helps to understand the concept.(edited)
in regards to matrices i disagree! for studying differential operators you don’t need matrices. of course, they are used all the time because it makes things easier to set up and solve but just if you understand the concept behind it. take keenan cranes “geodesic in heat” paper for example. you already have everything you need but you need to understand how it’s related conceptually.