Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 May 2012
Offline Last Active Today, 05:07 AM

#5302117 Tangent Space computation for dummies?...

Posted by on 23 July 2016 - 03:13 AM


Technically I can misuse any data-structure. A vertex is a point with edges to other points. I was just reacting to the comprehension part. Premature optimization. I remember engines which could only do flat shaded polygons. I do not know why current API do make the hack of vertex normals easier to use then the mathematical sound way of using the normal of the polygon. And I do not think that this is the case.

The GPU's concept of a vertex is "a tuple of attributes", such as position/normal/texture-coordinate -- the mathematical definition doesn't really apply :(

A GPU vertex doesn't even need to include position! When drawing curved shapes, "GPU vertices" are actually "control points" and not vertices at all.


There's also no native way to supply per-primitive data to the GPU -- such as supplying positions per-vertex and normals per-face. Implementing per-face attributes is actually harder (and requires more computation time) than supplying attributes per vertex, because the native "input assembler" only has the concept of per-vertex and per-instance attributes.


You could treat vertex as triangle and expand it at geometry shader. It just bit cumbersome and performance would be awful.

#5294511 Avoiding huge far clip

Posted by on 01 June 2016 - 12:17 PM

Quake used a farclip of 4096 - it's not as bad a problem as you seem to think it is.

It's also use 4 for near plane. This is ratio of 1 / 1024.

Absolute value of far plane isn't important the near/far ratio is.

#5286188 Occlusion culling w/o a Zbuffer

Posted by 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 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 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 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 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 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 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 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 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 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 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 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 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)