• A Complete Guide to Full Scene Rendering in Garry's Mod
    50 replies, posted
So I decided to make a guide all about scene rendering in Garry's Mod. In the guide I show you how to turn this: [T]https://picload.org/image/rgodoapi/common.jpg[/T] into this: [T]https://picload.org/image/rgowicgd/final.jpg[/T] ...so you can apply these procedures to your own scenes. This guide should also answer all the questions I was asked on how I [URL="https://img2.picload.org/image/rgogdodr/2k.jpg"]made[/URL] [URL="http://img4.picload.org/image/wdpccwi/combinebase.jpg"]my[/URL] [URL="http://picload.org/image/wagaopg/2560x1440.jpg"]recent[/URL] [URL="https://picload.org/image/rgdddalg/2kjpeg.jpg"]set[/URL] [URL="http://img3.picload.org/image/wgccdwl/bestlightyet.png"]of[/URL] [URL="http://img3.picload.org/image/woapiow/theexile.jpg"]pictures[/URL]. The guide will cover all the concepts, techniques, and methods used to accomplish this, as well as provide the theory behind it all. It does so by presenting the entire step by step process, from posing to final output. From the guide: [QUOTE]...some of these techniques and procedures were inspired/based on previous guides such as SonOfBrim’s [URL="https://facepunch.com/showthread.php?t=1468526"][U]lighting control in post[/U][/URL] / [URL="https://facepunch.com/showthread.php?t=1332299"][U]Z-Depth[/U][/URL] guides, and Darkomni’s [URL="https://facepunch.com/showthread.php?t=1112981"][U]shadow quality[/U][/URL] guide, all whom I’d like to thank. What I did was develop these concepts further with added twists, as well as add my own. Therefore I’m sorry in advance for repeating some of the concepts covered by these guides, but it’s necessary I do so for readability and consistency.[/QUOTE] We'll also be utilizing NeatNit's [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=636153716"]Soft Lamps[/URL] in the guide and quickly peer into their importance in a quality render. [B][I]EPILEPSY WARNING: Soft Lamps visualize each frame per render. This visualization may involve flashing lights, please be advised.[/I][/B] [T]http://i.imgur.com/21j8DI9.gif[/T] It's image heavy, so it'll take a bit for all of them to load. It's also long, but that's just because I do a lot of explaining (and because it has a lot of pictures). In practice, all of the procedure takes no longer than an hour's worth of work, so don't let it frighten you. [URL="https://docs.google.com/document/d/1OQ5nK11qKaOCNBT66Jd8Njf8vOkCmZe8Eywmn7JT2z4/edit?usp=sharing"][B]The full guide is available here![/B][/URL] If you have any questions regarding the techniques in the guide, as well as suggestions of your own, post them here - you're also more than welcome to post your test renders too! I'm honestly quite excited to see what people will come up with!
No offense, but that second image looks really oversaturated and gross. That sky looks terrible.
You're right, fixed. I half assed it, the actual output (before color corrections etc) looked like this: [T]https://picload.org/image/rgowioco/nocolorcorrection.jpg[/T] I guess I didn't really care for the artistic aspect at that point and wanted to show the procedure can produce a correct, balanced histogram, which can be over exposed without pixel burns.
The shadows are really neat. Haven't read tutorial yet, but what's the logic behind the soft shadows? Is it sonofbrim's thing or multiple lamps / soft lamps?
It's a little of both. It's about blending - you take a light and blend it with another light which neighbors the first in its position, and repeat. This works because soft shadows are really lots of hard shadows grouped together with uniform position intervals.
The pic on page 60 is actually good in itself. It looks like a hot summer day with dust blowing in the wind.
Damn son that's GREAT. Thanks alot.
This is just what we beginners need. Gonna use it sometime when I'm not lazy.
Does it only work for 1280x720 pictures? On your "fixed" pic, the bottom part of it is just a mess. Looks like non anti aliased picture with very bad sharpen effect over it. [img]http://i.imgur.com/qpQxfoy.png[/img] I dunno, can't say it's pleasing to look at it. [editline]15th May 2016[/editline] To be honest it may be just the source image being of very poor quality.
btw, on page 64 you're doing a cutout by taking the z-pass again to make it just black and white. There's no need for that. If you already took the original z-pass, you can manipulate it by adjusting the levels (CTRL+L) to get the same result. Simply adjust the levels to get a cutout. [editline]14th May 2016[/editline] You can also use that cutout as a mask to insert that blue original sky you wee trying to do without screwing up the white tree in the background. [editline]14th May 2016[/editline] [QUOTE=Robotboy655;50321192]Does it only work for 1280x720 pictures? On your "fixed" pic, the bottom part of it is just a mess. Looks like non anti aliased picture with very bad sharpen effect over it. [img]http://i.imgur.com/qpQxfoy.png[/img] I dunno, can't say it's pleasing to look at it. [editline]15th May 2016[/editline] To be honest it may be just the source image being of very poor quality.[/QUOTE] It looks like he sharpened that part too much. [editline]14th May 2016[/editline] Wait, I think I know, it's that grass itself, as you go into the distance it keeps the detail the same, making it look grainy. That's why I never use that grass model from Mask. I forget what it's called, but there's a certain source command you have to type to get rid off it.
[QUOTE=Crazy Knife;50321211][editline]14th May 2016[/editline] Wait, I think I know, it's that grass itself, as you go into the distance it keeps the detail the same, making it look grainy. That's why I never use that grass model from Mask. I forget what it's called, but there's a certain source command you have to type to get rid off it.[/QUOTE] You can either enable mipmaps for that grass texture or set source to render at a higher resolution and downscale. Both will significantly reduce aliasing.
[QUOTE=Robotboy655;50321192]Does it only work for 1280x720 pictures? On your "fixed" pic, the bottom part of it is just a mess. Looks like non anti aliased picture with very bad sharpen effect over it. [IMG]http://i.imgur.com/qpQxfoy.png[/IMG] I dunno, can't say it's pleasing to look at it. [editline]15th May 2016[/editline] To be honest it may be just the source image being of very poor quality.[/QUOTE] It works with any resolution your computer and Garrysmod can handle. I agree the entire ground is very noisy and filled with aliasing, and this indeed was because of poor source quality. Here's a direct loss-less output from one of the renders. [IMG]https://picload.org/image/rgowpiol/noiseexample.png[/IMG] I don't think this is Soft Lamp's fault given the normal poster output looks just the same noise wise: [IMG]https://picload.org/image/rgowpipc/noiseexamplenormal.png[/IMG] The extracts (source pictures) were 2560x1440 to begin with for the record. In an actual pose I'd recommend going with at least a poster 4 (if your current resolution equals your target resolution). In my last pose I used poster 7. You then downscale it in post to get rid of aliasing completely - I covered that concept in the guide. Here's an older example of the quality you can expect from downscaling. [IMG]https://picload.org/image/wrailda/foliage2.png[/IMG] [QUOTE=Crazy Knife;50321211] It looks like he sharpened that part too much. [/QUOTE] I never applied sharpening in the picture. I think it's all a combination of poor texture choice, hard edged grass, and a good bunch of aliasing. I let all those things pass as I really set focus on the building for the guide.
You should make a thread for the soft lamps thing. Like a tutorial and a download link with different settings and examples kind of like in that presentation.
Did you find them complicated to use? I wouldn't know myself how welcoming they are to a new user since I had a say / access into how they were designed in the first place.
Very in-depth guide, great job! Maybe I'll even complete something in Gmod for once now, but... I've ran into a problem, I get that it might easily be something on my end, but just on the off-chance that it isn't, I'll post here. When I first set up everything as described in the guide (autoexec stuff etc.) to check things out, it went fine. But the next time I started up Gmod I was greeted with this stuff: [t]http://images.akamai.steamusercontent.com/ugc/273969530039980395/A003D31C80C2FAC7CA7441013074A8B1996DB60E/[/t] This happens with everything I point a lamp or a flashlight at. And nothing seems to fix this apart from outright disabling dynamic lighting. Any help with that? I've no idea what caused this, I changed nothing.
[del]What you're getting is some sort of self shadow [URL="https://en.wikipedia.org/wiki/Z-fighting"]Z-Fighting[/URL], causing the prop to cast a shadow on itself. I've had it too. [del]This is probably a result of very high r_flashlightdepthres. I am 90% sure this can be solved by lowering the r_flashlightdepthres value. r_projectedtexturefilter with a higher value fixes this, finding a better solution, sec[/del] ​[del][B]e: Set mat_slopescaledepthbias_shadowmap to 2 (its default value), but it will compromise your shadow accuracy, alternatively you can set r_projectedtexture_filter to 0.05 which greatly reduces the noise volume[/B][/del] (I decided to embrace this noise as it disappears if there are enough lights stacked/blended together, and what it ends up doing is essentially making things darker where they should be. I've had plenty of noise on [URL="https://picload.org/image/rgladgda/capture.png"]this [/URL]guy and it all went away eventually without me having to do anything.) I should add this warning to the guide, will do so now. Try and lower it and let me know if it's fixed[/del]
Oddly enough, I've had experiences where that noise can be removed by just moving the fog/sky/sun editors under the map, or just away from your scene. I've got no idea what they've got to do with it, just something I've noticed.
[QUOTE='[LOA] SonofBrim;50331486']Oddly enough, I've had experiences where that noise can be removed by just moving the fog/sky/sun editors under the map, or just away from your scene. I've got no idea what they've got to do with it, just something I've noticed.[/QUOTE] [del]I have no idea why but putting it away really did improve the noise (but didn't get rid of it completely) Setting r_projectedtexture_filter to 0.05 reduces 85% of the noise but even that 0.05 addition compromises some shadow accuracy (especially on very small things like grass etc if the lamp is far away, if you care for those in your scene) [editline]16th May 2016[/editline] [del]This is also directly affected by mat_slopescaledepthbias_shadowmap. [editline]16th May 2016[/editline] [B]mat_depthbias_shadowmap 2 is the first lowest value at which this effect completely disappears, use that, but it will compromise your shadow's base accuracy (especially visible at its base on smaller scales with a long distance lamp), edited guide[/B][/del][/del]
i'm 90% sure you get the noise if your sky/fog/sun editors have shadows being cast on them, if you put them in a fullbright room like the one under gm_black that generally fixes it
[del]This is essentially what mat_depthbias_shadowmap does, while red equals distance set by value [IMG]https://picload.org/image/rgladwcw/shadowmapdepthbias.jpg[/IMG] (so the FINAL ray's distance, visually, is yellow + red) [editline]16th May 2016[/editline] Damn it, cross everything I just said, spawning a single editor entity still re-enables these clippings, what [editline]16th May 2016[/editline] Still trying to figure out what's causing it, it doesnt make sense that its just the editor entities.. [editline]16th May 2016[/editline] Apparently some entities (as long as they're within the projection box or in the map) cause this and some don't. The chair entity for example only causes this for 0.5 seconds, so I'm guessing it also spawns an invisible entity which it requires and is then removed, for instance The editors seem to cause this too, I've tried seeing what else produces this and so far tested thrusters, ragdolls, effects, and none seem to do this, I'm so confused[/del] [editline]16th May 2016[/editline] [QUOTE=gudman;50331261]Very in-depth guide, great job! Maybe I'll even complete something in Gmod for once now, but... I've ran into a problem, I get that it might easily be something on my end, but just on the off-chance that it isn't, I'll post here. When I first set up everything as described in the guide (autoexec stuff etc.) to check things out, it went fine. But the next time I started up Gmod I was greeted with this stuff: [t]http://images.akamai.steamusercontent.com/ugc/273969530039980395/A003D31C80C2FAC7CA7441013074A8B1996DB60E/[/t] This happens with everything I point a lamp or a flashlight at. And nothing seems to fix this apart from outright disabling dynamic lighting. Any help with that? I've no idea what caused this, I changed nothing.[/QUOTE] [I][B]Apparently this is caused by faulty materials on some rare entities that are within your projection box, the fog/sky/editors' materials being one of them. I have no idea why this happens. To fix this, take the material tool, and right click on your fog/sky/sun editors, this way you can keep them accessible and not have to push them under the map, updating the guide. Keep all the commands/autoexec settings on their original values (the ones listed in the guide) [/B][/I]​Thanks Brim/Cone for guidance, I was starting to lose my mind
Wow that's a lot of brainstorming right there, I'll test if this fixes it and report back. I'd like to also point out that while this err... stuff was happening, Soft lamp was doing this: [t]http://images.akamai.steamusercontent.com/ugc/273969530040607968/2692A9026F19925D7EEDFBB047E88806B8A5EC64/[/t] The odd shape near the centre is lamp itself, light is cast upon a plane of basic "building" shapes, giving off this very weird effect. Only the soft lamp, no matter the settings, was doing it, basic lamps worked "fine" - same as flashlight.
Odd. Seems like NearZ, could you paste a screencap of the full settings window?
[QUOTE=VIoxtar;50332322]Odd. Seems like NearZ, could you paste a screencap of the full settings window?[/QUOTE] I'll make sure to post the settings if it persists, but as I said, I tried tweaking all the settings, including NearZ, all that changed was the shape of it. [editline]16th May 2016[/editline] Oh, mat_depthbias_shadowmap 2 + hiding odd materials (editors) fixes it. And the problem with the lamp was... well I don't know, changing the projected texture/overlay back and forth between "hard" and "soft" fixed it. New problem though: now more than [b]two[/b] light sources completely just murders the game. One's fine, two are fine, but two lamps and a flashlight, no matter if pointed in different directions is a slideshow.
Always put the fog and skybox entitities underneath your map in the white container. Otherwise shadows get screwed up. By the way, is there an updated version of the soft lamp or sometihng? What's the direct link to the addon currently?
The one in the guide under things youll need title, or search soft lamps on the workshop [editline]16th May 2016[/editline] [QUOTE=gudman;50332340] New problem though: now more than [B]two[/B] light sources completely just murders the game. One's fine, two are fine, but two lamps and a flashlight, no matter if pointed in different directions is a slideshow.[/QUOTE] Every projected texture is now projecting near 40958976^2 rays in theory (unless it hits a maximum limit which is very likely), so yeah, lower r_flashlightdepthres if you care about performance, the settings I put up in the guide were posing/lighting/quality oriented
[QUOTE=VIoxtar;50334050] Every projected texture is now projecting near 40958976^2 rays in theory (unless it hits a maximum limit which is very likely), so yeah, lower r_flashlightdepthres if you care about performance[/QUOTE] Well, two points: a) I already lowered it according to my rig and b) for some reason it has a hard cap after just two lamps. Two lamps don't stress anything at all, but as soon as the third one lights up - slideshow. Instantly, the moment I turn it on. Any ideas why that can be? It's certainly not depthres, because I have it sitting at a waaaaay lower number than 1024*39k.
This specifically happens with soft lamps or any normal projected texture? I'm trying to replicate it, but other than just slightly lower FPS I'm not getting any extreme performance drops if you could name the map you're on and list down your current commands/settings (copy the autoexec file if thats the only settings you've applied) that would help
Finally got a chance to sit down and read this full guide. Gotta say, this brings together a bunch of strategies that have personally taken me [I]years[/I] to wrap my head around and puts them in one place. You did a great job making everything easy to understand as well, seriously awesome work.
[QUOTE=VIoxtar;50334280]This specifically happens with soft lamps or any normal projected texture? I'm trying to replicate it, but other than just slightly lower FPS I'm not getting any extreme performance drops if you could name the map you're on and list down your current commands/settings (copy the autoexec file if thats the only settings you've applied) that would help[/QUOTE] This happens with both normal and soft lamps. Soft lamp is affected more due to the fact that "extra" light sources it creates also count. Map's gm_blackv2, Autoexec contents: [code]sv_cheats 1 cl_maxrenderable_dist 7000 cl_detaildist 5000 mat_compressedtextures 0 mat_queue_mode 2 mat_bumpmap 1 mat_clipz 0 mat_autoexposure_max 2 mat_autoexposure_min 2 mat_disable_bloom 1 mat_specular 0 r_lod 0 r_flashlightshadowatten 0 r_projectedtexture_filter 0 r_DrawBeams 0 mat_depthbias_shadowmap 0 mat_slopescaledepthbias_shadowmap 0 r_shadowcolor 255 255 255 r_flashlightdepthres 10240000 mat_depthbias_shadowmap 2 [/code] So directly from the guide. r_flashlightdepthres doesn't matter in this case because I tried changing it to any number of fitting values from 8192 to 1024*10k, doesn't matter, and higher than that is already quite stressing.
[QUOTE=gudman;50336157]This happens with both normal and soft lamps. Soft lamp is affected more due to the fact that "extra" light sources it creates also count. Map's gm_blackv2, Autoexec contents: [code]sv_cheats 1 cl_maxrenderable_dist 7000 cl_detaildist 5000 mat_compressedtextures 0 mat_queue_mode 2 mat_bumpmap 1 mat_clipz 0 mat_autoexposure_max 2 mat_autoexposure_min 2 mat_disable_bloom 1 mat_specular 0 r_lod 0 r_flashlightshadowatten 0 r_projectedtexture_filter 0 r_DrawBeams 0 mat_depthbias_shadowmap 0 mat_slopescaledepthbias_shadowmap 0 r_shadowcolor 255 255 255 r_flashlightdepthres 10240000 mat_depthbias_shadowmap 2 [/code] So directly from the guide. r_flashlightdepthres doesn't matter in this case because I tried changing it to any number of fitting values from 8192 to 1024*10k, doesn't matter, and higher than that is already quite stressing.[/QUOTE] I have to say I'm a bit puzzled. If this didn't happen before you applied the autoexec settings then try and eliminate one at a time and see what causes this. I tried replicating it and couldn't. Also stay away from the 'Gameplay' settings on the soft lamps, stick to the HeavyLight ones instead. Luckily you can save these settings for just when you're done with posing and about to render, given you only need one light source per extract [QUOTE='[LOA] SonofBrim;50335485']Finally got a chance to sit down and read this full guide. Gotta say, this brings together a bunch of strategies that have personally taken me [I]years[/I] to wrap my head around and puts them in one place. You did a great job making everything easy to understand as well, seriously awesome work.[/QUOTE] Great, glad you like it
Sorry, you need to Log In to post a reply to this thread.