Custom Foliage Lighting Model

Hi All,

I have been doing some work on a custom lighting model for foliage. Basically its an approximate SSS that can be used to give foliage more life without the impact of actually using SSS. Grass uses an even quicker branch, allowing for a lot more instances. The demo that I tested on had 116,000 instances of the grass, and about 500 tree’s, running above 60fps. This is still a work in progress and can be optimized even further, and made to look better.

My plan is to eventually submit this as a PR to be included into the engine so everyone can use it.

Wow, you have ideas and work, but sadly no one can enjoy them if you don’t release them.

looking great. I have been needing a good foliage shader. Look forward to seeing it released

He mentioned in the post that his plan is to submit a pull request so it can be included directly in the engine.

  • seriously work dude, you’re a machine! I know a lot of people have issues with foliage lighting for large scenes, so I’m sure many will appreciate this.

Some ideas of mine dont make it out of the testing phase, such as the metaballs. (But I’m always happy to give people the source of what I have done so far). But this is not one of them. The main reason I want to go the pull request route is because to use this in your project, you have to modify the engine source to include the new lighting model, will be easier on everyone if its integrated into the engine.

Here you go:

Sorry for the bad camera footage, Im not a very good camera man :stuck_out_tongue: I’m still playing around with the grass, so what you see is not final. The grass model is the hero grass model from the SpeedTree grass pack. Bluriness is due to recording at 1280x720 and having TXAA on. Looks crisper at 1920x1080.

I already said it look very good, but would not hurt to do it again :D.

But I think it would be better if trees were more bright and less dark(shadowed, occluded ?), and ignore normals for shading completely. It might not be realistic, but could provide more plausible results.

Looking good! Great job ! I look forward to seeing it integrated into a Unreal Engine 4 in the future. What hardware have you tested it on so far? Thanks! :slight_smile:

Great job ! The foliage looks fantastic. Keep up the great work and I hope to see more of your work in the future. Have a great day!

Great! I really hope this gets implemented in the engine. Good job!

Lot better than UE4 default plant rendering , should definetively be in engine.

Hope this can be implemented into UE4!

Epic, any word on this? :slight_smile:

Integrate THIS into the engine. Would make a lot of people happy :slight_smile:

I am also very excited to see this integrated, having some performance issues myself and it just doesn’t look too good right now.

Very nice job Eham!

IMO it looks the same just washed out as if you turned down the contrast and brightened it up.

Can you do a comparison shot of the same scene? Also a comparison for speed in numbers.

Thanks everyone. Okay I am currently experimenting with a few settings. I am trying to reduce the waxy look they have. So the next set of screenshots are just testing, they may not look as good as the primary pics. I’m not satisfied with the results, but I wanted to get opinions of others. I do think the grass looks better, but I still have more work on the leaves.

and below is a video of me experimenting with back face lighting. As the light passes behind the object it reveals details as if light is passing through the object.

Are you sure that doesn’t have to do with the actual textures more? Either way, more options for users is better, I saw your video (if it was your creation) and I wonder how big scale would that setup work on with decent performance(?)

My own experience has been rather horrendous performance unless I use extremely simple setups for my grass and that is with just ~18000 instances of very low poly grass and approx same amount or a bit less trees (landing around 60 FPS as well) than Eham. Now I do not know what kind of hardware he has but I’m guessing it isn’t that far much higher than me (i5 4690k, 16gb ram, r9 290x tri-x). Personally I’ll take any possible way to improve my foliage performance issue.

EDIT: Just saw your last post, mind telling us your system specs Eham?

The grass does look better, why is the grass in the shadow much darker than the tree trunks?

Same as what? As the default lit shader? Or a standard subsurface shader? If the second, then thats good, thats what I am trying to get to without actually having the cost of the SSS. I will get to some comparison shots and speed tests once I have finalized the shader, as you can see by my latest post, I am still in the midst of testing. So things are bound to change. As for the lighting used in the screenshots, its just an ambient cubemap. Turned off eye adaption. and used color grading (LUT_Daytime) and thats it, didnt touch contrast.

I have darkened the textures of Speedtree a little, as I find them initially too bright. Performance wise, As long as you dont go crazy with the tris, should scale significantly well. I would recommend no more than 500 tris for a patch of grass, this way I was able to paint 288,000 instances without a significant hit in performance.

I am testing on a i7 3820 (3.7Ghz Quad). 32gb memory. Nvidia Titan Black and AMD Radeon R9 290X

Probably because of the default material setup, actually havent really looked at the trunk at all. Or the grass is darkening the shadows too much.

I say, that shadowed areas of trees, should be brigther. Dunno, if that is setting, which can be exposed, or something that had to be tweaked in shader. I would be fine with either option ;).