Jump to content

  • Log In with Google      Sign In   
  • Create Account


Dawoodoz

Member Since 16 Aug 2010
Offline Last Active Jun 19 2014 08:10 AM
-----

#5128120 Renderqueue / shader system design question

Posted by Dawoodoz on 02 February 2014 - 03:45 AM

I only sort by instances since anything advanced will just move the bottleneck to the CPU.

 

I use one opaque/alpha flag for the whole model and design with separate instances. This is not a problem since it is mostly particles and breakable windows that use alpha filtering.

 

I once tried removing the code that changed textures and the framerate did not change at all.




#5127959 AreaLight : Rectangle

Posted by Dawoodoz on 01 February 2014 - 10:25 AM

I don't see any multiplication with NdotL in the light intensity.




#5125824 Database modeling

Posted by Dawoodoz on 23 January 2014 - 03:43 AM

I discovered that higher normal forms on tables that I use to represent things in games reduce code complexity by up to 80% in safe languages. Instead of having 3 loops nested in each other, I have one loop over a list targeting child objects with many different parent objects in other tables.




#5120716 Shader Management for Lighting?

Posted by Dawoodoz on 02 January 2014 - 10:46 AM

 

In DirectX, I pasted some generic light sampling functions at the top of each shader before compiling them.

 

Pasted as in you paste in on every shader files, or you have some sort of a function that contains light texts in strings and combine it with every shader files to be linked during the first load?

 
I haven't got into shadow mapping yet, but thank you for your extra information, I'm pretty sure I'm getting there after this.

 

 

Pasted as text into every shader that is used for materials. I made it fast by saving pre-compiled shaders with check sums that tell if the shader has changed since the last compilation. The hard thing was to maintain backward compability without bloating the code to insert so try to have a powerful interface from the start that is compatible with, amibient, diffuse and specular light for solid, thin and fog materials. Fog will sample the light without caring much about the direction of the light. Thin materials like fabric will sample the light on 2 sides of the surface. I did not implement anisotropic light but think about how you can implement it later on top of the old interface just in case.

 

For sampling the depth maps, I sampled with both bilinear interpolation and the percentage closer method. I took the maximum intensity of both to remove acne from the percentage closer method. The depth bias was calculated dynamically, based on depth map resolution and dimensions of the light source. For a spot light, the bias must be multiplied by the depth (not distance) from the light source.




#5120700 Shader Management for Lighting?

Posted by Dawoodoz on 02 January 2014 - 09:42 AM

In DirectX, I pasted some generic light sampling functions at the top of each shader before compiling them. An array from the CPU stored up to 64 light sources that passed the culling test. Having more lights than that would be too slow to render anyway. They same thing should be possible in OpenGL and works without dynamic shader linking.

 

For depth based shadow mapping, I made a 2D allocation argorithm that is 100% free from fragmentation because the only way to free an allocation is to free every light source. Start with a whole square in bucket 0 and let the remaining buckets be empty. Each bucket can at most have 4 unallocated slots and that is only right before one of them is use or divided again. When there is no unused square of the right resolution, divide a larger square until you have something. The only case where you can't get more memory is when the total amount of pixels is not enough because no matter how many smaller sizes that use 3/4, their sum is always smaller than one larger square.

https://code.google.com/p/david-piuvas-graphics-engine/source/browse/trunk/Engine/QuadAllocator.cpp




#5066193 Starting C#

Posted by Dawoodoz on 30 May 2013 - 11:45 AM

I would stay away from any book that present any paradigm as a "silver bullet" since all programming paradigms have their advantages and pitfalls in different situations.

Functional programming is good for testability and GPU acceleration.

Data driven programming is good when the major bottle neck is loading lots of memory.

Object orientated programming is good when there is a clear one to one mapping between data and methods or you want safe polymorphism.

Relational programming is good when many objects share the same methods or you want persistence with a database.




#5060519 Entity state and animation

Posted by Dawoodoz on 09 May 2013 - 03:53 AM

My engine's SDK show how to make procedural bone animation from math so that jumping forward and landing sideway cause the character to sidestep when landing to keep balance. "BoneAnimation" is the simpler example and "GiantMaze" allow colliding with things. Previously I tried following the laws of physics with ragdolls that fall to the ground like drunk people but even with a perfect balance system you would still have to break the natural laws with air acceleration to make it fun to play.




#5060515 Making a texture 'point' at something?

Posted by Dawoodoz on 09 May 2013 - 03:30 AM


You can use a tangent function to compute the offset in the head's space.

Could you elaborate on this?

What would you be comparing to get the tangent?

 

 

EDIT: On Hodgman's suggestion, there's code to calculate the UVs of a point on a sphere based on a normalized direction (i.e: a radius connecting the center of the sphere to the point where you want to find the UVs). It's from the wikipedia article on UV Mapping:

 

761ef477fca2de40aed0cbbae3cbf9ca.png

ad415e568bc911ec29c8233d7c26bef2.png

 

So I could take the vector from [center of eye] to [object being looked at], normalize it and use that as d.

 

It all depends on how you projected the textures in the first place and flat eyes will always be a rough approximation. if you want real precision, you can rotate 3D spheres instead.




#5060223 Making a texture 'point' at something?

Posted by Dawoodoz on 08 May 2013 - 01:58 AM

Apply a UV offset from a constant buffer to move the eyes like that. Then you cover the edges by lerping the eyes to visibility where the skin's alpha is low. You can use a tangent function to compute the offset in the head's space.




#5060220 Another X vs. Y thread: Java + GWT vs. JavaScript

Posted by Dawoodoz on 08 May 2013 - 01:43 AM

Java is better for beginners than JavaScript because you don't have to learn HTML and you get consistent compilation to bytecode instead of randomly not working on a certain browser with a certain combination of plugins.




#5050260 How do I get feedback from my engine's users?

Posted by Dawoodoz on 05 April 2013 - 05:31 AM

I only hear from the users of my engine in the guestbook when they can't register the component and I have never recieved a bug report. I don't know if my engine is too good so that they never found a bug or too bad so that they don't use it. Making a forum did nothing since they don't believe that anyone will answer in an empty forum. The only answer I got in my survey is from when someone pressed the button by mistake.




#5050255 DirectX Window drops to 30fps when it is not the foreground window in Win7

Posted by Dawoodoz on 05 April 2013 - 05:17 AM

I think it is implemented in the DXUT code. One of the many reasons for throwing it away and making your own.




#5050244 Programming -The Game

Posted by Dawoodoz on 05 April 2013 - 04:24 AM

It is called University. Sometimes a professor give us 2 minutes to write an algorithm according to a specification and then everyone try to find errors in the code.




#5050243 Looking for engine.

Posted by Dawoodoz on 05 April 2013 - 04:16 AM

You need a company to make that happen unless you want to be tied up to Facebook or something. There are server costs, admins that have to get paid, patches that have to be synchronized for all players, hackers that want to cheat the game and ruin it for others... I suggest to start making a singleplayer prototype on one platform before thinking about multiplayer or cross platform since over 90% of game prototypes are thrown away for not being fun to play.




#5050241 Finished my first C++ book, where to go from here?

Posted by Dawoodoz on 05 April 2013 - 03:54 AM

Most of the safety conventions in C++ like clearing new allocations are already built in to C#. It is a big advantage to know both C# and C++ since C# is for rapid and safe development while C++ is dangerous to get more performance and control. Scripting is a powerful thing if you know where to use it because it allow you to replace modules at runtime when loading new levels and items that anyone can create.






PARTNERS