Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 24
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-28 19:11:30
Moved to my first own house. No more rent bullshit.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-22 21:51:35
Pretty much finished converting WSW to using JOML instead of LibGDX. Excellent library. Faster implementations, thread-safety out-of-the-box, smaller. Still awaiting a few features to be able to finish it and see how broken it is. =P

Did some profiling now that skeleton animation is over twice as fast thanks to JOML and found a physics bottleneck. The physics simulation uses a 2D grid to quickly find nearby bodies for collision detection. Each "tile" in the grid is just a list of bodies that are in that grid. To query nearby bodies, you pass in a position and a radius, and the grid returns all bodies that intersect the square the position+radius forms (circle test is too expensive). Since the grid tile size is bigger than the bodies, each body generally only needs to check 1 tile, or 2 or 4 if the query area extends across a grid boundary. While doing some optimizations getting rid of some unnecessary divides, I realized that there was a bug in there that expanded the search area by 1 tile in each dimension, meaning a 1x1 check turned into a 2x2, and a 1x2 check turned into a 2x3. This had a huge impact on performance as it basically does 2-4x as much work. In combination with getting rid of a few divides, Math.floors() and Math.ceils(), I almost managed to double the body-body collision testing performance.


What kind of perfomance scaling you have with increasing tile size. Many times I have found that making tiles much bigger than bodies is net win. Basically it increases number of hit test but fits cache much better.
3  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-21 20:20:56
Accidentally plugged node to wrong plug and computer just hard crashed. Infinite loop. Coding with ue4 Blueprints feels like doing bungee jumping with cord that is plait from spaghetti.
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-19 17:34:33
Matrix deconstruction without hefty assumptions is never going to be high performant. I needed to code this without corner cases for slicing game(Kinghunt) where I needed to dynamically reparent stuff and transformation chains were concatenated to matrices and didn't have time to change that. It was a very long day. If you have GPU Pro 5 in hand there is good article about ways to manage object hierarchies. http://www.crcnetbase.com/doi/abs/10.1201/b16721-29
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-08 08:25:36
I had problems with motion vectors stuttering during slow motion. With time running 1/20th as fast, the difference between in positions between each frame was minimal and the motion vectors are scaled up based on 1.0/timeStep to compensate. This amplifies floating point errors in the object and view matrices enough to cause seemingly stationary objects to get long enough motion vectors to cause motion blur to kick in. Running at a high resolution further increased the floating point errors. Computing object physics, object matrices and camera matrices with double precision and only convert them to floats when uploading them to OpenGL solves this.

This isn't motion blur anymore. Camera based motion blur is based on shutter speed. For Hardland I chosed shutter speed to be 1 /100 s. So with 60fps framerate I scale motion vectors with (1/100) / (1/60) = 0.6. If framerate dips lower scaling value just goes smaller. For realistic motion blur you never can't have longer shutter time than frame rate.
if you crank up motion blur with slow motion it might be cool effect but it's not actually motion blur effect anymore.
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-08-07 20:43:48
By the way, I forgot to mention it earlier, but the 48--->68 FPS increase I got from JOML included calculating all physics, model matrices and camera matrices at double precision. The physics were noticeably slower (10-20% longer CPU time) due to this. Double precision did help a lot with motion blur inaccuracies during slow-motion (difference between two positions scaled up by a large number) and also reduced model and camera jitter a lot. This led to less motion blur and anti-aliasing reprojection artifacts in the scene.

EDIT: Skeleton animation was of course done at float precision.
How you are doing motion blurring? Sounds bit odd that you would ever have precision issues with it. I just use last frame mvp matrices which are always exact.(if object wasn't visible on previous frame I use current matrices which is not problem for temporal AA and hardly problem for motion blur.). Actual motion vectors are scaled from difference vectors using frame time and camera shutter time.
7  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-07-10 19:26:11
Planes don't actually need to be normalized if you never ask actual distance from the plane.
http://iquilezles.org/www/articles/frustum/frustum.htm
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-09 09:23:14
Spent the entire day preparing RFLEX for the greenlight push. The majority of the day was spent working on a game demo for the press kit. I spent the last 4 hours getting a list of 35 game writers to email, and making a game plan for greenlight Tongue.
Try to get contact with Youtubers. They are lot more valuable than game sites.
9  Game Development / Newbie & Debugging Questions / Re: LibGDX - Combine textures? on: 2015-06-15 17:32:01
You don't move or rotate textures. But meshes that are texture mapped. Putting all those textures to single atlas does not simplify this thing at all. It may improve performance but it does not make it simpler.
10  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-12 18:57:38
Upgraded our project to UE4.8. Everything seems to be going to right direction.
11  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-08 21:10:50
Yes! Managed to get the depth of field as good as physically possible when generating it from a sharp image.

Have you considered to combine motion blur and DOF. This way you could reuse most of the samples.
http://bartwronski.com/2014/12/09/designing-a-next-generation-post-effects-pipeline/
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-06 07:34:31
Tried to get depth of field working. Didn't go very well, but by carefully dodging all the artifacts I could take the following screenshot.

Try this technique. It's lot simpler and there are tons of optimization opportunities.
http://bartwronski.com/2014/04/07/bokeh-depth-of-field-going-insane-part-1/

Bruteforcing it is too slow for gameplay scenes but usually you want to use crazy dof/bokeh only for non action parts anyway.(cut scenes etc)
Hardland is actually shipped with naive variation of this but its only used when player inspect something or chat with npc.
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-02 21:43:33
Temporal array? You mean the vec4 sraaSamples[SRAA_SAMPLES] array?
Yes. I meant just that.
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-02 21:08:48
Theagentd could you post more of that shader code. If there is way to avoid that temporal array it should be lot easier for register pressure.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-01 19:49:07
...
Quote
                    Pack transparency : 0.515ms
                    Fast resolve pass : 0.254ms
                    Stencil mark : 0.322ms
                    Full resolve pass : 0.492ms
The wrongly named transparency packing (e.g. the complete precomputation pass, to be renamed) went up by 0.1 ms, but the fast resolve pass shaved off 0.1 ms too. The full resolve pass also got quite a bit faster, losing almost 0.3 ms too. All in all, we're down to just under 1.6 ms, a pretty amazing result considering the same process took 3.4 ms a few days ago.

With those precomputation optimizations is the fast resolve pass + stencil markin still a win?
16  Game Development / Newbie & Debugging Questions / Re: Efficient Collision detection on: 2015-06-01 19:44:50
Does your game in hand actually have performance problem with collision detection right now?
17  Game Development / Newbie & Debugging Questions / Re: Shadows flicker (Shadow Mapping) on: 2015-04-29 21:06:59
Snapping to texel is great with translate only but does not completely solve problem with orientation change. Only way to fix that is to push screen pixel to shadow texel ratio high enough and use wider sampling kernel. So you want to push your effective shadow resolution as high as possible. For Hardland I use standard cascade shadow maps but I also clip sub frustums to ground plane(I just use min of height map for frustum area). Then I try to fit this clipped frustum to minimal projection area. I just use 60 different shadow camera up vectors and I choose smallest projected area. Usually worst up vector produce twice as high area.

Remember also put far plane to edge of frustum.
Keeping the extent constant and the shadow map square is supposed to fix that.

Some how I skipped that part. But this basically waste lot of effective resolution.

Luckily my temporal antialiasing filters out rest of the noise.

More advanced techniques.
http://www.realtimeshadows.com/sites/default/files/Playing%20with%20Real-Time%20Shadows_0.pdf
http://advances.realtimerendering.com/s2010/Lauritzen-SDSM(SIGGRAPH%202010%20Advanced%20RealTime%20Rendering%20Course).pdf
18  Game Development / Newbie & Debugging Questions / Re: Shadows flicker (Shadow Mapping) on: 2015-04-29 17:12:19
Snapping to texel is great with translate only but does not completely solve problem with orientation change. Only way to fix that is to push screen pixel to shadow texel ratio high enough and use wider sampling kernel. So you want to push your effective shadow resolution as high as possible. For Hardland I use standard cascade shadow maps but I also clip sub frustums to ground plane(I just use min of height map for frustum area). Then I try to fit this clipped frustum to minimal projection area. I just use 60 different shadow camera up vectors and I choose smallest projected area. Usually worst up vector produce twice as high area.

Remember also put far plane to edge of frustum.
19  Game Development / Newbie & Debugging Questions / Re: Textured Greedy Mesh on: 2015-04-08 19:43:28
Shaders should be first thing that you learn when you start to fiddle with graphics programming.
20  Java Game APIs & Engines / OpenGL Development / Re: Lightning and Bump mapping on: 2015-03-23 18:50:17
Deferred rendering would solve this perfectly. Render normals and albedo(diffuse textures) to framebuffer. Then render each light as quad using albedo buffer as input and output to backbuffer with addditive blending.
21  Game Development / Newbie & Debugging Questions / Re: [LibGDX] [Solved] How to rotate a single texture in a spritebatch? on: 2015-03-22 00:09:41
1  
2  
void   draw(Texture texture, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY)
//Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.


There is this monstrosity what you should call when you want rotation and not use TextureRegion/Sprite.
22  Game Development / Newbie & Debugging Questions / Re: Basic enemy movement where A* isn't really needed? on: 2015-03-21 22:20:26
Please don't use state machines for AI.

http://gameprogrammingpatterns.com/contents.html

Read this book about programming patterns.

Why one should read that? In what particular section AI is talked? Why no state macines?

You argument is like saying God hates X. Read the Bible to learn the truth. Absolute zero information.

23  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-16 21:54:39
Remember when i posted that i figured out bump mapping? Yeah, i was wrong. The sphere was normal mapped correctly only when the light was at a certain position.
I looked up the problem on google and struggled for 3 days to get the thing working. Basically i needed to convert the light & eye position to texture-space, then do calculations on that.
To do that i needed to calculate the TBN (tangent, binormal, normal) 3x3matrix and multiply lightPos & eyePos by it.
I had a lot of problems on the way, like having some sort of "gradient" on the faces that were rendered --->
I was trying to pull off some sick math to remove it, but then the next day, i deleted the code, so i could start over.
I looked at the code for a bit, and then spontaneously surrounded the tangent vector with a normalize() function. It worked. HALLELUJAH !

Math seems to be lot intuitive if you transfrom normalmap normal to world/viewspace and do lighting there. This also make normal mapping code lot less intrusive and cost is not dependant of numbers of lights. It's also way to go with deferred rendering.
24  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-16 21:51:01
I looked at the code for a bit, and then spontaneously surrounded the tangent vector with a normalize() function. It worked. HALLELUJAH !

Might want to normalize them before sending them to the shader, less GPU instructions the better. Wink
You need to renormalize it at fragment shader anyway.
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-15 22:18:48
yea they look like more useful for path animations.

performance is better compared to bspline/catmull but that's cos' you have to cache lots of the coefficients (an extra vec4 each controlpoint) while with bsplines/catmull you can compute them in-flight, doing that with natural would be devastating.

code is pretty much inspired by http://www.cse.unsw.edu.au/~lambert/splines/ - it's more about getting it to blend nicely with the rest of the code/project/utils. not sure if it'd help to post a wall off arrays adding and multiplying the crap out of vectors. Wink

Any precomputing would not suite for my purposes. I have tested catmull-rom with skeletal animation and it does work really nicely and is basically one line replacement.(if you don't count nasty "what frames this animation should use" code).
26  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-15 20:25:04
finished another round on spline-interpolations. made it a bit dimension and vector type/class agnostic Smiley
natural-cubic

Natural cubic look nice. Any chance to share the code? How performance compares to catmull-rom?
27  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-15 00:12:43
I improved the performance of the grass rendering a lot. This scene was running at 44 FPS. With the new optimizations, the exact same scene, down to the pixel, runs at exactly 60 FPS.
...
The grass is drawn as a shitload of simple quads. This causes heavy overdraw, to the tune of 34 million fragments or 16x+ overdraw per pixel at 1920x1080p, before depth and alpha testing. Since alpha testing is used, this disables early depth testing which means that even though something like 80-90% of those fragments never end up on the screen they still cost a lot of performance. Add the fact that the grass is rendered to the G-buffer which consists of 3-4 render targets and you end up with extremely bad performance. What I did was to separate the rendering of the grass into two passes. I first do a depth-only pass which uses a simple shader for alpha-testing the texture. This is reasonably fast even without early-Z since the shader is so simple. In the second pass, I DISABLE alpha testing and change the depth testing function to GL_EQUAL and render the grass as usual. The result is identical to depth testing, but the depth-testing performance is improved a lot even though everything is rendered twice.

Did you tested to sort those quads from front to back. Alpha test does disable early depth test but does not disable hi-z. Probably does not matter because your grass blade seems to be lot thinner than hi-z resolution. Is that foliage deferred or forward?

Have to test this method for Hardland too. I too have tons of foliage and sometimes it can be real performance killer.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-12 23:29:39
@pitbuller: That looks very nice. The smooth shading looks good, but the game's lighting seems "over-bloomed." Very nice art style.

I have heard so many comments about bloom so maybe I should ask our artists to tune it bit down.
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-12 21:52:28
Implemented proper distance based soft shadows for Hardland. Quite happy that it also fixes light leak bugs with thin objects and cascades.

Algorithm works like this:
Blocker search: First calculate average distance using fixed size grid from pixel to blockers.
Calculate kernel size from average distance using light source size and shadow camera parameters.
Calculate occlusion using kernel size and spiral pattern. 32 samples using hardware pcf so total of 128 shadow comparision.

Comparision screenshot. http://screenshotcomparison.com/comparison/115815
Code ended up to be really neat.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
#define samples 32
#define blockerSearchRadius 6
#define blockerSearchStep 6
 
 
float computeShadow( float4 viewPos)
{
        float3 proj = mul(u_viewToShadowMap, viewPos).xyz
 
        float distance = 0;
        float n = 0;
        [unroll]
        for (int x = -blockerSearchRadius; x <= blockerSearchRadius; x += blockerSearchStep)
        {
                [unroll]
                for (int y = -blockerSearchRadius; y <= blockerSearchRadius; y += blockerSearchStep)
                {
                        float4 blockerDepth = u_texture0.Gather(samData, proj.xy, int2(x, y));
                        float4 diff = saturate(proj.z - blockerDepth);                                        
                        distance += diff.x + diff.y + diff.z + diff.w;
                        float4 n4 = diff > 0.0;                                        
                        n += n4.x + n4.y + n4.z + n4.w;
                }
        }
        if (n == 0) // not in shadows
                return 1.0;
       
        float sunSize = 0.01;                  
        float maxPenumbraSizeInMeters = 0.2;
        float kernelSize = 0.001 + min((sunSize * shadowCameraSizeInMeters.z) * (distance  / n), maxPenumbraSizeInMeters);                    
 
        float2 size = (kernelSize / samples) / u_shadowCameraSizeInMeters.xy;
        float angle = 0; // use your favorite rng here to dither.
        float angleStep = 0.55;
        float shadowTotal = 0;
        [unroll]
        for (int i = 0; i < samples; i++)
        {
                angle += angleStep;
                float2 uv = proj.xy + i * size * float2(cos(angle), sin(angle));
                shadowTotal += u_texture0.SampleCmpLevelZero(shadowSampler, uv, proj.z);
        }
        return shadowTotal / samples;
}
30  Java Game APIs & Engines / OpenGL Development / Re: How to avoid duplicate shader code? on: 2015-03-09 00:01:41
For different permutations I like to just use simple #defines. Easy to code and maintain. Code is in one place and can also be edited in 3rd party ide without your engine.(shader profilers, debuggers)
Pages: [1] 2 3 ... 24
 
Coldstream24 (18 views)
2015-09-03 00:41:28

Andrew_3ds (30 views)
2015-09-01 19:08:10

afikri (20 views)
2015-08-31 09:30:22

afikri (27 views)
2015-08-31 09:30:07

afikri (15 views)
2015-08-31 09:27:24

afikri (17 views)
2015-08-31 09:26:40

Roquen (32 views)
2015-08-29 11:30:54

GamerC4 (41 views)
2015-08-22 20:38:50

GamerC4 (37 views)
2015-08-22 20:37:18

GamerC4 (43 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!