Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 May 2012
Offline Last Active May 22 2016 10:02 AM

#5286188 Occlusion culling w/o a Zbuffer

Posted by kalle_h on 10 April 2016 - 02:48 PM

That is correct. When bounding box/sphere is fully inside of all those 5 planes then it's fully occluded. 

#5278333 How does everyone test their hlsl code?

Posted by kalle_h on 26 February 2016 - 11:47 AM



You can make it even better. In our engine we load assets instantly if they are changed on disk


I prefer a key combination for that because you can instantly see old and new behaviour without anything between (alt-tabbing etc.).

edit: I somehow broke the quoting system and can't modify or remove the quoted section.


I prefer dual monitor for this. No alt tabbing from shader text editor to game to press hotload button. It would be nice that if engine would take screenshot before and after hotloading. Most of the time this is what I want.

#5278054 How does everyone test their hlsl code?

Posted by kalle_h on 25 February 2016 - 05:17 AM

In my game, I have a button that lets me re-load any modified files. Other engines like Unity also support this.

Then you can simply write code while the game is running and watch the results. If you're not sure about something, you can always add "return" statements in the middle of your code to visualize intermediate values.

You can make it even better. In our engine we load assets instantly if they are changed on disk. This way you don't need to hop between different windows all the time. It sounds very minor improvement but it's drastically make things better. Just small amount window to window hopping lose your focus and ruin the flow.

#5265488 Static lightmaps and dynamic objects with realtime shadows, how?

Posted by kalle_h on 08 December 2015 - 03:23 PM

Currently I am not sure how big the scenes are going to be - im trying to research how i am going to handle shadows before deciding haha! But they have potential to be quite long, as the levels are going to be designed missions which will have different environments etc but all from the standard city builder perspective (mine isn't a builder game, but the perspective is the same)


There may be like 20 dynamic objects.


I had thought about doing a big static shadow map, and updating it with dynamic objects, but that seems excessively large as I was hoping to target mobile platforms!


just seems so overkill to have dynamic object shadows, but alas, i cannot think of a better way of doing it sad.png

You don't need to update static shadow map with dynamic objects. Just render dynamic object to their own map. And when rendering all objects just sample from both shadow maps. This way you can just use depth textures and hardware PCF.

#5259395 Full dynamic octree, worth it ?

Posted by kalle_h on 28 October 2015 - 03:53 AM

What kind of queries you are going to need? If you just need single query for frustum culling which is linear operation then updating octree would just be more expensive. But if you have hundreds shadow casting point lights then it would make perfect sense.

#5258874 Light vs Mesh culling causes specular discontinuities.

Posted by kalle_h on 24 October 2015 - 04:25 PM

Is your falloff function actually going to zero? Squared inverse is correct falloff but it does never result zero. You need to modify function somehow. I have used this: max(0, (1/distance^2) - epsilon)

#5258622 Rendering Quake 3 BSP in modern OpenGL

Posted by kalle_h on 23 October 2015 - 01:12 AM

Simple alternative would be just sort room size chunks front to back after frustum culling and rely on Hi-Z culling.

#5258469 When you Fix your timestep Do you need to change the physics

Posted by kalle_h on 22 October 2015 - 12:38 AM

It smells that you are trying to use pixels as world coordinates.

#5252618 Omni-Directional Soft Shadows

Posted by kalle_h on 17 September 2015 - 02:52 AM

Soft shadow algorithm would make point light shadows look much nicer. http://www.bahilov.com/rt/img/3.0%20soft_shadows_hd.png


Penumbra size = Light size * (Blocker distance  / Total distance)


Light size is known constant. Total distance is given. For blocker distance you need to make blocker search. Usually you need bit few samples there than in shadow filtering pass. I just discard all samples that are further than total distance and average rest of the distances. If there are no blockers you can just skip the filtering pass.

#5252544 Foliage Collision

Posted by kalle_h on 16 September 2015 - 12:58 PM

In Crysis 3 they are converting all physics shapes to multiple spheres. If you split grass instances to chunks you can just cull colliders per chunk and it's also easier to update distance chunks less often. Trying to update all grass once might not be best for flexibility and performance.

#5252408 Foliage Collision

Posted by kalle_h on 15 September 2015 - 02:13 PM

Seems to be quite basic sphere collision system with many optimizations.



#5252318 Many (IBL) CubeMaps / Bindless Textures

Posted by kalle_h on 15 September 2015 - 03:16 AM

Simple way to do this even with older hardware is to accumulate all cube maps using proxy geometry(sphere/cube/quad) and rendering to rgba16f target. You output color * weight to rgb and weight to alpha channel. Just render cubemaps as one by one and finally you use fullscreenpass to renormalize reflection buffer by dividing by alpha.

#5251186 Precalculate lightmap and specular reflection?

Posted by kalle_h on 08 September 2015 - 12:01 PM

It's also quite usual to use ssao to darken specular reflections. Some use straight AO * specular but there are also some better approximations that try to take account view dependency and roughness.

like: lerp(1.0, ao, roughness * (1.0 - nDotV))

or:  saturate(pow(nDotV + ao, roughness*roughness) - 1.0 + ao)

#5249605 Octree Frustrum Culling

Posted by kalle_h on 29 August 2015 - 01:36 PM




"Simply not worth the cost just to avoid drawing a few off-screen triangles" - THAT

I do not agree. You cant say that because you may be sending 100% of the model when you are actually seeing 5%. If the calculations per vertex are expensive or you are GPU bound (saying that cause my GPU is not the greatest and doing extra stuff seems to be unnecessary


It's not very good for overall conversation that you split quote like that.

Actual quote should be:



Subdividing meshes at run-time is overkill and simply not worth the cost just to avoid drawing a few off-screen triangles.

Which has totally different meaning.



But back to the point. There was great presentation at siggraph from Ubisoft. http://advances.realtimerendering.com/s2015/aaltonenhaar_siggraph2015_combined_final_footer_220dpi.pdf

They are doing super precise frustum and occlusion culling on gpu. Using just 64 triangle strips as primitives. But the conclusion was bit disappointing because they didn't get huge overall gains even after all that effort.

#5248777 sRGB on diffuse textures or gbuffer color texture?

Posted by kalle_h on 25 August 2015 - 09:17 AM

In my experience, the 10/11 bit formats (float and unorm) don't have enough precision to pull off good HDR without introducing colour banding.

n.b. 8bit sRGB is equivalent to approx 10bit UNORM linear, so that leaves you approximately no headroom for dynamic range sad.png


If you don't have extreme dynamic range I have found that 11 bit is just enough with some careful dithering. At least it work for us in Hardland.