Instanced Grass

Labs

Instanced Grass
Instanced Grass

A few weeks ago, George asked me whether it would be possible to have random color variation for his instanced grass scene. He wanted to achieve something more appealing to the eye than creating numerous instances with the same look.

– Giannis, I would like to setup grass very quickly with color variation. What I would like to have, is a noise procedural taking different values from instance to instance.

– George, this requires quite a few (small) additions but it would be indeed very nice to have.

And So We Started…

I liked the idea so much that, putting aside everything non-urgent, we started working for it. First of all, we would need to have a special channel based on the instance index. Second, certain changes on the engine, to be able to link between the instance index and UV coordinates. And third, it should be interactively available using Presto (which means that I had no excuse anymore but to – finally – implement Perlin Noise for it).

I have to say that the result was astonishing, not in terms of rendering (we have seen greater renders than my simplistic tests) but in terms of workflow. With a few clicks, you can transform a scene with boring instanced grass to something way more colorful. Checking the title image above, you can see how a grass scene was rendered before and after applying the new effect.

This effect is one only addition of our next edition which will be feature-packed. We are putting a lot of love into it and it certainly worths all the waiting.

Ever since writing his first program (on a home computer, back in the eighties), Giannis has always been amazed by computer graphics. He likes challenges and discovering the math and physics that govern our world.
  • Very cool Giannis, I’ll be happy to test that the day it goes out 🙂

  • Theodor Pokorný

    Thank you Giannis for sharing this. Blogging was great idea.
    I am excited to heave procedurals for Presto.

    I also had an idea so here is my try:
    – Giannis, I would like to setup multyple components ( instances) very quickly with texture position variation ( uv position ). What I would like to have, is a noise procedural taking different values from instance to instance.

    practical example:
    I want to set up a table with four identical models of a chair. Texture UV mapping usually gives away that I just copied the same model, but I wish for noise procedural that would asign random values, that would translate into random texture displacement (offset of X a Y
    coordinates ) . Thus achieving practical result of having identical 3d model of the same chair with the same texture and uv mapping. But the chairs will not have the same knot in exact same place.

    Is this even possible ?

    • Ioannis Pantazopoulos

      The implementation above was about selecting a color from a noise procedural, based on the instance index. I don’t believe it is the same, because you are asking for a variation for the same instance, right?

      • Rombout

        Using some sort of random materializer would be great, cant it be combinated?

        • Ioannis Pantazopoulos

          Ok, now I get the point (also from Joao above). Indeed, it is interesting idea that the instance index could be used to select random material.

          • That’s great Giannis… Please let me annoy you a bit more: :S

            Don’t forget about animation and re-rendering a scene. The shuffling/randomness should be able to be repeated through all the animation so that wood grains don’t move from one frame to another.

            Re-rendering a frame on a different day, or re-rendering a region render should also keep the same randomness initially created (Am I making sense?) Most software that deals with Randomness I use (like Substance Designer or Skatter) uses a seed value to govern randomness.

            Of course you are much more aware of this than myself as you deal with that sort of thing in your programming for sure, but for people who don’t know seed values are a great way of testing different outputs (for instance forcing two wood knots to get far from each other) and a way to “store” random results.

          • Ioannis Pantazopoulos

            The animation will be consistent, except if some instances are deleted from one frame to another (i.e. changing order). That shouldn’t happen though unless someone intends to do it like this. Your “seed” value in this case, is an offset at the Perlin Noise procedural (by changing the Offset & Scale of the procedural you influence how the color varies among instances).

          • I see how the perlin noise in this case is the governing factor… Could we do it with a custom Texture/Bitmap, that wouldn’t need to be a perlin noise, or the procedural calculation is fundamental in the process? I see great things being acomplished with bitmaps too… Like carpets, commercials, and I would have a special scenario where color variation would be great but would need a grid base texture…

            I guess this is the problem with features… They always lead to bugs in one side, and more feature requests in the other. I’m sorry 🙂

          • Ioannis Pantazopoulos

            Yes, you could do that with any texture! Random variation was the most obvious but controlling this with a custom texture (say to give a smooth gradient) is also possible. It is just that the texture has to be tailored to your instance distribution.

          • Theodor Pokorný

            That would be great indeed. Although there is a still a need to create multiple materials to choose from.
            Here (http://thearender.com/forum/viewtopic.php?f=24&t=19503) I propose that instance index could be used to generate texture displacement ( shift, offset ) for material on each instance.
            (please see the pdf attached to the formum post)

          • Rombout

            Perhaps it could be used to make dfferent shades of colors or color variations. Different workflow for your current version

      • João Queiroz e Lima

        That grass is looking good, and this is a very welcome feature! Congratulations!

        Implementing Perlin Noise in Presto is even greater news!

        However, I feel a color noise (or other channels) is not enough for textures with huge contrast variations, like marble veins or wood knots Theodor is speaking of.

        That UV variation on the same instance is a feature that has been asked for some time now, and it would be a great one as with 1 material and one model, we can have infinite possibilities.

        Another way of achieving it, wich is less efficient but more realistic, is to assign multiple materials to instances of the same model. That’s what I’ve been doing on repetitive components, like wood beams, doors, lamps… to create randomness, but I have to do it manually on my modelling app. It would be great if Thea would use the instance index to shuffle materials from a given folder.

        Whatever the solution that could be used, it would be important to have a seed governing the randomness so things won’t change from one render to the next…

        • Ioannis Pantazopoulos

          The multiple material assignment for instances is the logical way to go and actually something that’s still open for implementation. [That wouldn’t need to be random, user can assign which material goes to which instance.]

          • João Queiroz e Lima

            But if it’s the user that assigns wich material goes to wich instance, how can I deal with a hundred wood beams?

            I’m probably not understanding…

            But this seems an huge hassle. Let me try to explain a practical example:

            – I have a roof I want to render and it has 100 similar wooden beams;
            – In Sketchup (wich is my modeller app, but I think this is valid for other apps too) I should, ideally make a single component definition and instance it for the 100 beams. This allows for a change in one beam to affect all. But in order to define correct UV’s for a component one has to assign materials directly to faces inside the component. However this forces all components to have the same Material AND the same UV. So now we have a terrible render as every beam has the same wood grain.

            – To solve repetition one has to make every component unique. Then we either create 20 materials and randomly assign each to a component (wich still makes around 5 repetitions per material but…), or we create a single material and change each component’s UV’s positions (offset, rotate, flip…) so that it doesn’t look the same (this is not ideal eitehr as it still might show two similar knots next to each other). This process ruins modelling workflow as from the moment you make every component unique, you loose the ability to change one, and change every other.

            – As I’m an architect and I’m pushing my ideas to clients through renders, I’m always finding a hard time thinking on ways to achive both nice renders and a somewhat reasonable workflow, but it’s very very hard as projects keep changing and renders keep being needed to keep them moving forward.

            So, finding a way to deal with this issue, is probably one of the things we need the most from Thea as we all want to easily create a natural and realistic feel to our renders but we don’t want to waste our time rebuilding a fast workflow to achieve it. Imagine this on stairs, balaustrades, street lamps, wooden doors and windows, balconies… It’s really a problem that exists everywhere in architecture except in single houses. But it also affect vegetation like trees, furniture, cookies, marbles spheres, complex tile materials wich need to be modelled, panels… everything that creates repetition.

            How this is solved, I don’t know, but Ideally we would simply assign a material in our app, and Thea would know that this material would have to be randomly replaced by a multimaterial folder, or by a single material with a shuffle in UV position properties, or, even better, by both multimaterial and UV shuffle.

            Giannis, I’m sorry for this exhaustive explanation and for probably not understanding what you were saying in the first place, but I rather look like a fool, to not expose my concerns and expectations!

            Thanks for all your hard work and putting your talent into Thea!

          • Ioannis Pantazopoulos

            No worries; should we have this, random assignment will be possible. I am just saying that there may be a scenario that user would like to override that.

          • We should be able to upvote 2 times! Thanks for enlightening me!

          • Ioannis Pantazopoulos

            No problem. And I am sorry for my short answers.

  • Jan Sandström

    YES! Finally it’s coming. Really looking forward to try this. Thank you!

  • Juan Carlos Uribe Ortega

    This is great!! cool giannis!

  • Rombout

    cool cool cool… So this ca be used for other items as well than, right?

    COuldnt the object pass be used for this, i mean object pass can see seperate items and give it a color. Using this in the render engine could be done or not?

    • Ioannis Pantazopoulos

      Right. It would need an extension to use object-id (& material-id) but yes, it would be possible. How do you intend to use object id?

  • I really want to play with all these new features. Thank you for all your love! 😀

  • Gannis, think please about add sets of coordinates to use with textures. I many of my complicated materials I use different coordinates for textures even in the same place like diffusion, glossy, etc. Some of them uses UV, ad some Cubic with different scale for each one.
    It don’t have to be a “node-based” solution but a simple drop-down list. Coordinates setup could be available form gui place (icon) similar to Emmision, Displace… you know what I mean. You click and you have coordinates set setup tool.

    • Ioannis Pantazopoulos

      I understand but showing the same coordinates at two different places (inline with the texture and in a separate gui channel), will lead to confusion. [We are making some brave moves for next edition (simplifications and taking out things) exactly in order to have better workflow.]

  • oandroido

    Any word on this? 🙂

  • How’s it coming along?

  • Pingback: Procedurals supported by Presto AO/MC | Thea Render()