[CLOSED]Projectors & Bump mapping

Is it possible to use bump/normal mapping with Unity projectors?
For example, imagine you want to make bullet holes look cooler with depth, so you add a bump mapping to that bullet hole projection.

Note: Please don’t stray too far from the main question about projectors and bump mapping by saying its a bad idea to use projectors for bullet marks, because its too expensive. Its not forbidden to talk about it, just don’t stray too far away from the path

I’m sure this effect can be implemented, but it would requires to modify some shaders or even to develop your own projector system.

I don’t have a ready to use solution but here are some leads.

If you have a look at the projector shaders from the Standard Assets, “Projector/Light” or “Projector/Multiply”, it is possible to modify such that they accept a normal texture. However theses shaders are vertex-fragment shaders, this type of shader by-pass the lighting pipeline, which makes the normal texture useless.

A direction you could dig further into, is to try to write a projector shader as surface shader (instead of vertex-fragment). Maybe that could work.

Damn! I know nothing about shaders…

Is this a good place to start?

I’ve skimmed through this video, the first 10 minutes is a nice introduction to shader, after that it becomes more a tutorial to make post rendering effects using Image Effect.

I would advice to start here:

Also, if you are new to shaders and you haven’t program any before ( for instance in OpenGL or DirectX), this is going to be a tough trip. Programming shaders requires knowledge about Computer Graphics and the rendering pipeline (how a 3D model defined by vertices and triangles end up as colored pixels on the screen) and good grasp of the mathematics involved. So you would need to know how to handle vectors and matrices to transform coordinates between the different spaces (model, view, projection, screen, …). So, be warned and prepared :).

decals can take bump mapped textures… is there a particular reason you’re attached to the projector approach? seems to be the “hard way” given the effect you’re after :eyes:

Don’t know what decals are but going to take a break from shaders and research it

With decals, you generates a mesh and “stick” it to the object you want to modify the appearance. There are several solutions on the Assets Store implementing decals. Since a decal is a regular mesh, you can use whatever shader on it, including one with bump map.

1 Like

I’d tack “object pooling” onto the end of that research if you’re not already familiar with it. Having a pool of “x” bullethole decals and recycling the old ones as new ones are made is going to be far more performant that instantiating/destroying them over and over.

All the stuff I find about decals are plugins on the asset store. Doesn’t Unity have a native decal system?

check out the example code linked to from Unity - Manual: Extending the Built-in Render Pipeline with CommandBuffers

edit: and it would appear the new shaders in unity 5 did away with some of the older decal stuff… :frowning:

Yes I’ve downloaded that same project. Been trying to replicate the decal process but with no success

Another question. What if I wanted to project a transparency instead of a texture, using either projectors or decals. Is it possible?
For example, if I had a wall and a flashlight, and wherever that flashlight was shinning on the wall, you could see through it.

bumping

Bumping… map? :slight_smile:

I would approach this last effect without using neither decals nor projectors. Instead I would pass the parameters of the cone produce by the flashlight to a custom shader that will accordingly compute the alpha value of each pixel of the wall. Though, the effect would look a bit dull. I guess x-ray-looking through a wall, would render the wall as some sort of transparent volume with some sort of cross sections at the flash light border.

So depending on the kind of result you want, this effect can fall the range from simple to advanced. Also, it might be a join effort both on the technical side and the artistic side.

There was a working mesh decal system in the old bootcamp soldier demo project. Not sure how it works in u5 though.

Allright guys. Thank you for all your help so far but this proved to be a little too much time consuming (and maybe a little too impossible as well xD). I failed to find a solution of alternative in these last few days so my boss has decided to leave this feature out of our application. Maybe we’ll come back to it in the future, who knows, but for now we are moving to more pressing matters.

Again, thank you for your help.