Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Simple PBR material

A topic by rustinlee created May 09, 2018 Views: 620 Replies: 2
Viewing posts 1 to 3
(1 edit)

Hey all,


Here's a quick stab at probably the simplest version of a PBR material you can do. This one only supports one hard coded light.  To use this material, you'll need to turn off the built-in lights; to do this, copy the default shader template and comment out `color += light;` then set it to your active template under Raymarcher's Advanced drop down. You also need to add #include "UnityStandardCore.cginc" to your CustomIncludes.cginc or your new template.


$lightDirection is a *normalized* direction, everything else should be straightforward. The light color was coming in really underwhelming so I've overridden it to (lightColor*3)^2, maybe I've just made an error in the parameters I'm passing in above, if so let me know.

Just did a little more testing and the last line here is wrong, instead of LightingStandard(s, normal, gi) it should actually be return LightingStandard(s, rayDir, gi) or LightingStandard(s, normalize(UnityWorldSpaceViewDir(p)), gi) but I'm not 100% sure which.

Thanks for sharing!