General CRYENGINE Discussion

View unanswered posts | View active topics


Post a new topicPost a reply
Previous topic | Next topic 

User avatar   Uber Modder Uber ModderMember since: 04.04.2010, 18:17Posts: 1389Location: Canada Eh ! Likes: 20
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 05.07.2011, 21:31 
Very Informative, thanks !


Image

User avatar   Uber Modder Uber ModderMember since: 14.03.2008, 21:31Posts: 1760 Likes: 38
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 05.07.2011, 23:13 
Chapter 4:
Hidden feature: Point Light Shafts

So the next article will feature a thing probably only few of you will know, but I hope to boost the popularity of Point Light Shafts, despite their drawbacks.
So let's get to the topic. I was thinking a long time about the title of the article, things like "Pump up your (light) volume" came into my mind, but ultimately I decided for the "Hidden Feature" title, because Point Light Shafts are, just like Deferred Shading Tiling, not enabled by default in the Crysis 2 version of CryEngine 3.
After some misleading comments below I need to point out, ALL OF THIS IS DIRECTX 9!

Chicken, the next article will be about Global Illumination :)

What are Point Light Shafts (PLS)?
Point Light Shafts are ...
pictures express more than 1000 words. Power-Ranger!
Image

Or how about 2 Point Lights with Beams enabled?
Image

Even though they have some flaws, this functonality will sure come in handy for many Screenshot artists.

So, as usual, let's begin with the cVars.

r_pointlightshafts Standardvalue="0" - Set to "1" to enable this effect.
that's it.
If anyone finds some useful debug cVars for the effect, let me know, I'll update this section.

So after setting r_pointlightshafts to 1, we have to modify the light source.
Simply set PostEffect to 1, as shown below.
Image
Done.
Have a nice time trying out.

I think it is awesome that they included this effect for point lights; however, I am somewhat disappointed by the way it is excecuted. In fact, I think these posteffects look way worse than they do in Unreal Engine 3 for instance and it makes me wonder why they did not overtake the effect from the way it works with sunbeams. But at least, one does not have to make a light cast shadows in order to have correct beams like it was the case in CryEngine 2.

Note: This feature has not been publicly showcased yet and will hopefully improve when the SDK comes out, so do not judge the Crytek team too harshly yet.

Problems:
First of all
there are some flaws which could, really really easily be fixed.
The intensity of the lightbeams have the same problem like their predecessors in spirit from CryEngine 2. The volumetric effect (fog density) is way, I mean waay to strong (dense) if compared to the actual light intensity.
In a typical Crysis 2 scene, most point lights actually have DiffuseMultiplier values of 2 and up, and HDRDynamic is usually set to 1 or more.
With that settings the lightbeams are so bright, one cannot see anything but a glowing ball.
The only useful settings are below a multiplier of 1 and something very close to 0 for the HDR.
But then the objects in the world are barely affected by the color again, so the best thing to do is to make another, non-beam, point light with the right multiplier values. From a performance standpoint that's stupid, but artistically there is no other way.

Second thing
The lights seem to look like a spherical fog volume with some effects.
What I mean by that is that even after objects that should occlude the lightbeams, one sees some fog.
On the picture below one should not see the green on the wall to the right, because the light is actually behind the edge. In other cases this looks way worse.
Image

Third thing,
like in CryEngine 2, Objects that are in front of the light beams "blur" into the fog effect.
No stencil prepass is used [yet]. Zoom in to see what I mean. Again, this example shot does not even portray worst-case.
Image

Oh yeah and it doesn't work with e_screenshot, but get over it, the Engine was developed for games not for stitching techniques.

Is it all that bad?
No, for certain things Point Light Shafts are still great. Look at these shots
No more need for lightbeam geometry in central station!
If you want to open those in different tabs, Off and On!

Image
Image

And what about performance?

Let's take a look at this scene
If you want to open those in different tabs, Off and On!

Image
Image
We see for the same scene the cost for PostFX rose from 0.66 to 1.82 ms.

If you want to open those in different tabs, Off and On!

Image
Image
Same thing here. 0.42 to 1.65 ms per image. One should note though that the amount of screen space and radius of the light generally affect this value. For every new Light with this post effect with the same size, I saw an increase of about .6ms.
I might investigate more in this area, but for now it'll do.



So overall...?

Point Light Shafts

Pros
- better effect than lightbeam geometry, especially when in motion
- useful for a variety of scenes
In comparison to CryEngine 2 volumetric light
- better performance
- does not need to calculate shadows in order to calculate beams (!)
- is not restricted to beams, works in all directions

Cons
- color multiplier of volumetric "fog" not in line with the actual color multiplier of the light affecting the scene
- do not work with projected lights [yet], therefore no good use as spotlight beams.
- image quality not perfect, examples are given above
In comparison to CryEngine 2 volumetric light
- beams are not supported [yet]
- do not work with e_screenshot, CE2 beams do

Conclusion:
There is not much to be concluded here, except that I hope that Crytek fixes the issues mentioned before. I hope it was interesting for the creative guys, who can now try this technique out and bring us beams of awesome.

CryEngine 2 shot (recently done by me for MWLL, using e_screenshot, scene was below 10 Fps...)
Image

and another CryEngine 3 shot, a good example of where these lights make sense in a game
Image


Liked the read? Want more? Give me some feedback! Don't hate!
Want something to be featured? Say it!


Last edited by Thomy on 06.07.2011, 08:27, edited 2 times in total.
  Uber Modder Uber ModderMember since: 17.06.2011, 10:49Posts: 1473Location: Germany Likes: 7
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 05.07.2011, 23:31 
with dx9 its only round :puppy:

Image


Intel Core i5-2500K
ASRock P67 Pro3
8 GB DDR3-1333
GTX560 2GB
Win7 x64
User avatar   Uber Modder Uber ModderMember since: 14.03.2008, 21:31Posts: 1760 Likes: 38
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 05.07.2011, 23:33 
yeah I mentioned that it does not work with projected lights.
I don't have Dx11 either.
  Experienced Modder Experienced ModderMember since: 01.12.2007, 20:29Posts: 521Location: Germany Likes: 3
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 03:29 
Too bad you can't create parallel light beams. Sun rays are parallel and you have to use all sort of tricks to get good looking sun rays in a forest for example.

And also the cryengine2 lightbeams have some cvars for adjusting the quality of the beams. Hopefully they will also get reinserted in cryengine3.


User avatar   Has no life Has no lifeMember since: 02.02.2007, 07:25Posts: 5206 Likes: 253
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 03:42 
Pointlightshafts is DX11? And no volumetric spotlight? What a joke lol
  Beginner BeginnerMember since: 04.04.2011, 00:39Posts: 32 Likes: 0
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 04:03 
These are really great and informative articles, thank you for making these! Keep them coming! :)
User avatar   Uber Modder Uber ModderMember since: 14.03.2008, 21:31Posts: 1760 Likes: 38
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 05:53 
Quote by Thomy:
I don't have Dx11 either.


@Crysuki
Point Light Shafts work with DirectX9... also, if you've looked at the editor screenies provided above, you see it's all dx9
again, this is not a fully deployed feature, so why talk negative

@Sebastian
I agree, too little customization so far, not only for these but also for SSR, which would have been even more interesting to modify.


  Uber Modder Uber ModderMember since: 17.06.2011, 10:49Posts: 1473Location: Germany Likes: 7
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 10:41 
i took RollupBar/lights/light .

which used you ?


Intel Core i5-2500K
ASRock P67 Pro3
8 GB DDR3-1333
GTX560 2GB
Win7 x64
User avatar   Uber Modder Uber ModderMember since: 14.03.2008, 21:31Posts: 1760 Likes: 38
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 11:02 
same as you. The results you showed above are exactly the results i get.
Turn up the radius and turn down the multiplier and the put stuff in front of the light (in the radius)

EDIT:
Personal opinion:
Best realtime renderer in the world and my favorite engine :)
Image




Last edited by Thomy on 06.07.2011, 23:11, edited 3 times in total.
  Uber Modder Uber ModderMember since: 10.02.2008, 13:12Posts: 1450Location: Estonia Likes: 3
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 11:11 
Nice read really digging the info about the "hidden stuff",
Looking forward to new articles :)
User avatar   Uber Modder Uber ModderMember since: 14.03.2008, 21:31Posts: 1760 Likes: 38
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 21:48 
Chapter 5:
Global Illumination

So, as requested, I will talk a little bit about one of the most appraised features of the CryEngine 3 - Dynamic Global Illumination. Personally, I believe there is not a whole lot to talk about, because basically most of you guys know the Editor and probably tried out all the GI functionality, so I cannot really tell you any news in that regard, and for the ones who are really into the technology behind it, you can read about everything you need to know in here.
If you are completely new to this topic, just skip to "What is Global Illumination".

Well let's begin with the most important thing for the ones who are somewhat familiar with the feature -
glossy reflections do not work.

Let's say that again, glossy reflections definetely do not work in the current version of the Crysis 2 SDK. If by some accident, I am deeply wrong about this, I would happily be lectured.

And, as it seems, the chance of getting some huge improvements on Global Illumination when the SDK ships are, by any means, very low. I might be wrong, but I'm pretty sure with this prediction.
Now that is because the head behind the technology, Anton Kaplanyan, left Crytek after they launched Crysis 2. Reading his twitter one finds out that he surely did not leave brokenhearted; Crytek seemingly had some special views on working conditions and (not granting any) royalties.

Well I prefer to actually talk about the tech than some internal conflicts at Crytek, but as it seems the approach used for approximating GI will not stay CryEngine 3 exclusive, because Kaplanyan released code samples on Nvidia (to be found here: Diffuse Global Illumination)
and some engine junkies already worked it out. Check out this video.
Interestingly enough, they also implemented "realtime glossy reflections", in the comments they explain that it's basically the approach Crytek uses. Well wanted to use.

Enough of the negative talk, let's get to the feature.

What is global illumination?

Global Illumination means that light is not restricted by the radius of a light source, but will actually reflect of surfaces to create Indirect Lighting and Color Bleeding.
The first picture is without GI, the second one with GI enabled (exxagerated effect)
Image
Image
You can clearly notice the light bounces off the wall to illuminate the rest of the cube in a yellow light.
In CryEngine only the sun light actually bounces off surfaces, so if we want to work with Global Illumination, we have to concentrate on outside areas with a more or less dominant sun/moon light. Global Illumination is enabled from "Very High" and up.

Basic Control is given with adjusting the "Global Illumination Multiplier" in the "Time of Day"-Tool, which I am sure most of you are familiar with. Should be easy to find.
Another thing artists can modify are the reflection/color bleeding values for their objects in the "Shader Params" of the Material.
Image
I recommend to leave it as is in gray or at least grayscale (the brighter the more color bleeding, black values won't reflect anything) because the reflection will be calculated with the color value given by the diffuse map, so changing this settings to anything but grayscale is only useful in special situations - Exampleshot


Let's get to the Cvars, they are the most important modifier.
Best thing would be to just click on the console with your right mouse button and enter "e_gi" to search. Now one can easily modify the whole look of it.

In the following list, I will not progress in the order you see when you open your Console Variables, but rather in a way that I can progress from one to another without having to explain everything twice.

IMPORTANT - HOW IT WORKS
How it works and where the magic starts. Basically an image is created from the perspective of the sun of the area where the player/camera actually is. This image has depth, color and slope information and it is used to calculate where and in which direction light is reflected.
Now obviously this is not calculated for the whole map but only for the area in front of the camera and the area's size is determined by
e_GIMaxDistance Standardvalue="100". By setting the MaxDistance to 1000, Global Illumination will be calculated for an area 10 times as wide and long. Examples?
Look at these distances: 50, 100, 200, 400 and 600
The offset of the GI in front of the camera can be adjusted by
e_GIOffset Standardvalue=".2", which translates to 20%. One can tweak image results with that, but I didn't find anything better than 0.2.
Increasing the area with e_GIMaxDistance however, will not translate into worse performance, because the resolution of the image will stay the same. So, even though we have a much greater area affected by indirect lighting, locally details will get lost in a dramatic way.

To encounter this problem one could, in theory ( :( ) set
e_GISRMSize Standardvalue="384" to a higher value, BUT it won't get you much beyond 512. Sizes like 32, 128, 256 are the ones where you see a difference.

Anyway,
in this calculated area, all the small irradiance volumes (cheap lightsources), which are used to create the effect of colorbleeding and indirect light are stored in a "Light Propagation Volume".
This "LPV" can be cascaded just like Shadowmaps are cascaded - different cascades store different sizes of lights which are reflected.
e_GINumCascades Standardvalue="1" - By Default however, there is only one cascade with 1 size of irradiance volumes. Got complicated?
If you turn up the Number of Cascades (up to a maximum of 6) you will get 6 different sizes of reflected light areas. In Effect this means more detail.
We can further adjust these cascades with
e_GICascadesRatio Standardvalue="2" - the given value will determine how much bigger the different reflected light areas in each seperate cascade are. So if you have 4 cascades and CascadesRatio set to 1, each Cascade will have 1 time the rate of the one before so in total... every cascade is the same. You will notice a massive overcast of light.

Got all of that? Now we'll get to the ones, which are easy to understand, yet still effective.

e_GIIterations Standardvalue="10" - with this value you can control how far the light reflection "reaches out". So if you have light bouncing off a wall and you have a very high value, the light will reach the wall to the opposite, 30 m away. The shorter the iterations the colors will "bleed". This value has no impact on performance.

e_GIPropagationAmp Standardvalue="3.3" - this value will determine how much the intensity of the reflected light decreases over distance. The lower the value, the earlier does it fade out.

e_GISecondaryOcclusion Standardvalue="0" - Important if one wants to have good and accurate results. Set to "1" to enable occlusion of the reflected light. If disabled, the indirect light will pass through everything (as far as set before with e_GIIterations). If enabled, objects will stop the light from passing.
If you want to open those in different tabs, Off and On!
Image
Image


Got all of that? The next ones are almost self-explanatory.

e_GI Standardvalue="1" - Set to "1" to enable this effect.

e_GIAmount Standardvalue=".6" - Defines the multiplier of the Global Illumination Indirect Light. No real need to give examples I guess. It's best to modify the Global Illumination Multiplier in the Time-of-Day-Tool, instead of tweaking this value if one wants to change the lighting for an actual level (for good).

e_GIBlendRatio Standardvalue=".25" - In theory this defines the overlapping between different cascades, but in practice I don't see any change. If there really is any, I'd be happy to hear about it.

e_GICache Standardvalue="7" - The given value will determine how often the reflective shadow maps are updated, which basically determine the look of the illumination.
"7" means every 7 frames.
Ever noticed how parts of the lighting were still building up when you quickly turned around ingame? Yeah - here is the reason!
If you want "Realtime all the time" set it to "1" and watch your framerates and your CPU melt. Well unless you have an i7 or anything like that.
But if you love to move solids in the editor and always watch how slow the GI reacts to it, actually the lowest value I would recommend is "3", that feels very smooth even if playing with about 30 FPS. Of course, if you have a very high framerate, you won't feel the difference between 3 and 4 frames anyway...

e_GIGlossyReflections Standardvalue="0" - Setting this to 1 will overwrite the other settings and excecute a e_Gi config that results in short bleeding and indirect light. Ignore this cVar because it won't bring you glossyreflections.
EDIT: Since 3.4.0 it does:
And from what i see it works nice:

Image
Image
Image
Image



Wow that was a lot of writing. I hope I helped some of you guys!

So after all this tweaking and everything... is it any good?
At first I was rather disappointed, but after working with it for quite some time I think it definetely is an effect that can in many situation, clearly improve visuals.
In others, it sometimes makes the image feel unnatural.
Let's begin with the good examples. I took some shots in Crysis 2.
First two are with GI, the third one has GI disabled.
Image
Image
Image

Problems with the GI however evolve around 1 central problem:
The dependence on a grid.
While it wouldn't run if it wasn't for the insane performance one gets with this nested grids (cascades) filled with hundreds of cheap lights /irradiance volumes, the issues with it are quite evident. If a wall does not fit the grid, the lights will simply bleed through.
An example would be these stairs.
GI ON / OFF. (secondary occlusion does not help)
Image
Image

another problem -
the indirect lighting is constained to 6 axis and therefore some angles are just not perfect.
Image


So overall...?

Dynamic Global Illumination in CryEngine 3

Pros in comparison [color=#FF8080]to Unreal Engine 3 Approach[/color]
- No precomputing (very huge)
- No tweaking of hundreds of parameters necessary, results are visible instantly
- Every (dynamic) object can potentially reflect light
- memory friendly
- no visual flaws with overlapping realtime and precomputed direct/indirect shadows

Pros in comparison [color=#FF8080]to Frostbite Engine 2.0 Approach[/color]
- No precomputing (Frostbite Engine needs to precompute and analyze all static geometry)
- faster iteration possible
- light bounces off all potential objects (in Frostbite only static geometry reflects light)
- memory friendly

Cons in comparison [color=#FF8080]to Unreal Engine 3 Approach[/color]
- only sun computed, in contrast to all static light
- visual quality dramatically lower, depending on the time spent precomputing
- needs more processing power
- did not work on consoles for Crysis 2

Cons in comparison [color=#FF8080]to Frostbite Engine 2.0 Approach[/color]
- only sun computed, in contrast to all lights
- visual quality dramatically lower
- updating is not in realtime, unless one really wants to sacrifice a lot of performance
- did not scale on consoles for Crysis 2



Conclusion:
It's hard to come to a conclusion, because Crytek really sacrificed a lot just to have "Realtime All The Time". That brings some real improvements as well as some huge drawbacks.
First of all the engine's ability to look great in-doors as well as outdoors, which was really advertised with the introduction of deferred rendering, suffers a little in comparison to others on the market. Lighting-quality-wise they are behind both outdoor and indoor.
Still, one cannot deny that for the performance and the obvious pluses like a completely dynamic solution, the results look pretty good.
And, when combined with EnvironmentalProbes and SSR, results can look very convincing :)
(male bust is without EnvProbes, the coloring is partly from SSR and partly from GI)
Image
Image

Liked the read? Want more? Give me some feedback! Don't hate!
Want something to be featured? Say it!
I am happy with every little "thanks" I get because it shows somebody appreciates that i put quite some hours into the articles and the research behind them :)




Last edited by Thomy on 05.08.2012, 13:39, edited 1 time in total.
User avatar   Hardcore Modder Hardcore ModderMember since: 23.09.2009, 19:59Posts: 999 Likes: 29
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 06.07.2011, 23:49 
once again great. i think the biggest problem of gi is that it doesnt effect shadows. like u showed in the picture of the emergency car. the car looks reat and is illuminated, but the shadow isnt. however, in reality the shadow should get brigher. could it be that the light cant bounce of a wall, which already recieved gi?

another problem is that the floor, which gets gi'd by a lightbeam of the sun wont be illuminated.

still great tho. btw, do u have some comparison shots of the other engines?
User avatar   24/7 Modder 24/7 ModderMember since: 16.06.2008, 22:11Posts: 4307Location: Oulu, Finland Likes: 7
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 07.07.2011, 08:46 
Lot of enlightening stuff in these articles :happy:

You really can write well. Articles are easy to follow and quite educative.


Zip-line release 2012-04-24 (for CE2 & CE3) · C1 mod project: A mod called Entry
Assets · Blender: Destroyable object tutorial for CryBlend

- currently lost in New Eden -
  Uber Modder Uber ModderMember since: 17.06.2011, 10:49Posts: 1473Location: Germany Likes: 7
 

 Post Topic: Re: CE 3 Tech you might not know about [article series] - Pa
PostPosted 07.07.2011, 13:25 
gi in cryengine3 is like, I walk with a big flashlight around :(


Intel Core i5-2500K
ASRock P67 Pro3
8 GB DDR3-1333
GTX560 2GB
Win7 x64