Jump to content

Anyone work with Decals?


Recommended Posts

Hiya! I'm still new to Houdini and I was wondering if anyone had made use of 3D decals (projected textures) in Houdini? I've found them really useful in the past and I was wondering if anyone had played around with them. 

They look like this kinda thing:

decalfinishedworking.jpg

I'm not talking about the Decal material node, I mean things similar in effect to what is talked about in this blog post.

Thanks!

Edited by Jack Fractal
Link to comment
Share on other sites

decals, as Jack mentioned, are projected textures :P
usually on top of other objects or terrain that already have a texture themselves.
Its like using camera-space UVs (but from a non camera object) to add texturing on top of other objects.

I have personally not used them inside Houdini, but it should be totally possible to create decal-spawning-positions and orientations, and then use those in your game engine.

If you want to use them inside Houdini, you may need to do some more advance shader writing, or you could apply your decals to the vertex colors,
which should be relatively easy to do, but less optimized of course as you'll need high-res geometry.

 

Link to comment
Share on other sites

On the UV Texture Sop with the Texture Type use "Perspective from Camera" and assign your camera. Like 6ril said you may need to use multiple uv layers if you are stacking textures or UV Co-ordinates. In your shader or engine, just maker sure it reads the appropriate UV channel for the correct texture.

Link to comment
Share on other sites

In realtime engines the decals are are often projected at render time, and these days against the g-buffer (a.k.a. world-position pass in offlineland)

 

And I think it's a good idea to give these kinds of techniques a special name, makes it easier to speak about them.

 

Link to comment
Share on other sites

3 minutes ago, eetu said:

And I think it's a good idea to give these kinds of techniques a special name, makes it easier to speak about them.

It's the same concept as the century old Matte Painting for film, or even predating that by a few centuries with the camera obscura. The same math and technique are still applied. 

Link to comment
Share on other sites

Thanks everyone! 

@acey195 Thanks Acey! I think I want to avoid going with really heavy geometry if I can avoid it. The issue I'm seeing with doing the decals within a shader is that it looks like I'd need a separate UV node and several nodes for the add and blend operations per decal. If I wanted to use a lot of decals (thousands?), I think that would blow the draw-calls out like crazy for that material. 

@LaidlawFX Ah! I forgot that the UV project SOP had a camera projection. That will definitely make things easier. Thanks!

@eetu Definitely agree on the name thing. One of the problems I run into a lot with my day job is that in 3D, so many terms are re-used over and over again for different concepts. I saw in one of your threads that you'd done something like this with a particle system projecting bullet holes onto a cube. Was that done with decals or were you actually spawning geometry at the collision points?

My goal for this is a bit weird. I want to be able to use decals as part of a texturing workflow for some NPR stuff I've been noodling about with for a while. My idea is to use decals to project surface details onto a model, then bake the decal into texture maps to simplify the shader.

Link to comment
Share on other sites

From my small research on the topic, making decal is trivial. Transform shading P into decal projector object space and use it as UVs. Then you will get decal's color and alpha. However, you cannot place decal projectors and project materials onto another materials:

decal.gif

They will not receive decals. You need to dive and unlock, then modify each scene shader to make it do such thing. Therefore you cannot efficiently use decals in Houdini. At least, without writing some Python tools.

If you want to use your own shader for procedural texturing and project decals only on it, it is simpler task. Here is my tries to make in more or less usable: decals.hipnc

Single texture blending was used, but it may be full material layer blended with main shader using Layer Mix node. Which is what you usually expect from decals.

  • Like 2
Link to comment
Share on other sites

1 hour ago, Jack Fractal said:

My goal for this is a bit weird. I want to be able to use decals as part of a texturing workflow for some NPR stuff I've been noodling about with for a while. My idea is to use decals to project surface details onto a model, then bake the decal into texture maps to simplify the shader.

 At R&H we did this for our background environments, it was primarily a converter from other proprietary applications, I believe Vodoo, but I'm not 100% sure. I only saw it from the shader and Houdini end that I worked with. So it's definitely been done, i.e. it is 3-D Matte Painting which is the film term of what you are doing. So it is a bit of a custom setup, and not off the shelf. Maybe h16??? We did whole surface blocks on R.I.P.D. and we were just mimicking other studio setups. Plus Houdini has a much better texture baking rop now, than back then, so it will probably be a week of work to make a good reiterative tool set, maybe, depending on the level of complexity and amount of learning you have to do. Some of python f1 was talking about could help make the process faster.

  • Like 1
Link to comment
Share on other sites

Hey f1480187! Thank you so much for the example, that's exactly what I was looking for! I do have one question:

In your example, the 'Objects' and 'Textures' parameters are linked to the String and String1 nodes... somehow, but I don't know how. I also don't know how they're defined and controlled by the expandable set of 'Projectors' and 'Texture' options.

This looks really useful but I can't figure out how to replicate it! 

Link to comment
Share on other sites

@Jack Fractal, I didn't find better way to iterate over [obj_node, texture_path] pairs inside shader. For no reason I decided that decal in this example may be any object, not limited to something like custom Decal OBJ HDA, which can store it's material on itself, and also contain sopnet with a good visualizing network (but not too good, otherwise you will prefer SOPs to render-time decals)!

Both parms are Python scripts. RMB Menu > Expression > Edit Expression. They collect entries from multiparm (Projectors parm allows for object masks like "/obj/decal_garbage*"), expand patterns into objects, override conflicts with later definitions and so on. It's easier to try out. I made it inaccessible by expression set in Parameter node Disable When. In real asset, I'll probably just hide it. You can enable it, remove scripts and carefully write pairs delimited by spaces manually. It will be inconvenient, probably.

Current setup will not work with texture paths containing spaces, due to bug in Split String VOP, which does not work with anything except spaces. When it will be patched, scripts should be modified to delimit entities with newlines instead of spaces. Then space should be replaced to '\n' in Split String VOP.

  • Like 1
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...