Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (593)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (647)
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  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.
2  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.
3  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/
4  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.
5  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.
6  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.
7  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?
8  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?
9  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
10  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.
11  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.
12  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.
13  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.
14  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.

15  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.
16  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.
17  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).
18  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?
19  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.
20  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.
21  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;
}
22  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)
23  Discussions / General Discussions / Re: GDC 2015 - various stuff on: 2015-03-06 09:44:19
Kite demo is almost Pixar level stuff. I needed to double check that it is actually real time.
24  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-26 11:06:40
Anyway, the point here was how the I stored the triangle ID in the first pass. I render and light the scene to a GL_RGBA16F render target, with accumulated light intensity stored in RGB and triangle ID stored in A, the alpha channel. During lighting, the shader only outputs an RGB color:
1  
out vec3 fragColor;

In this case, Nvidia's shader compiler set alpha to 0.0, and since I was using additive blending this left the triangle ID unmodified. AMD's compiler however set alpha to 1.0, which corrupted the triangle IDs completely, leaving my SRAA resolve shader utterly confused.

How about using color mask?
https://www.opengl.org/sdk/docs/man3/xhtml/glColorMask.xml
25  Game Development / Newbie & Debugging Questions / Re: shader not working on my machine on: 2015-02-23 00:06:13
Show the fragment shader code if you want some help with it?
26  Game Development / Newbie & Debugging Questions / Re: shader not working on my machine on: 2015-02-21 21:58:24
Now your shader compile fine. Rest of bugs are from render monkey.
27  Game Development / Newbie & Debugging Questions / Re: shader not working on my machine on: 2015-02-21 21:00:16
Why you are doing uniform transform matrix math manually per vertex? Build up one mat4 at cpu containing all transformations and concanate that with view projection.
28  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-21 18:52:10
I found some nice optimizations for bounds testing in shaders. Basically my motion blur was blurring over the edge of the screen, resulting in either black color if I used texelFetch() which gave a dark aura around the screen when in motion, or being clamped to the edge pixel if I used texture() which inflated the weights of the edge pixels. Neither of these looked very good, so I decided to simply remove the samples that fell outside the screen. However, detecting these scenarios was expensive.
...

Another idea. If my memory serves me right valid samples have alpha channel of 1.0 even if the texture does not have alpha channel but invalid texelFetch() results just zero to all channels. At least this is what you get with dx. https://msdn.microsoft.com/en-us/library/windows/desktop/bb509694%28v=vs.85%29.aspx

Another way to get this behavior is to use border color.

So with this behavior you can just simplify code as:
1  
samples += texel.a;
29  Java Game APIs & Engines / Java 2D / Re: 2D game engine. on: 2015-02-21 12:03:44
Suggesting noobies to use your own engine is as annoying and harmful than trying to convert people for your belief system.
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-19 19:58:56
Some correction in coloring and normal mapping. Currently I'm trying to figure out a rendering scheme that places the characters on top of the shadows, but still affects them with the lights. Hm...

Everything in that screenshot just screams DITHERING.
http://loopit.dk/banding_in_games.pdf
Pages: [1] 2 3 ... 24
 
deepthought (37 views)
2015-06-30 15:39:44

deepthought (39 views)
2015-06-30 15:39:09

deepthought (52 views)
2015-06-30 15:36:52

Za\'Anzabar (22 views)
2015-06-29 05:44:54

TritonDreyja (40 views)
2015-06-24 17:10:40

CopyableCougar4 (36 views)
2015-06-23 00:34:45

BurntPizza (42 views)
2015-06-21 20:36:46

cookiecompiler (85 views)
2015-06-11 15:42:53

cookiecompiler (48 views)
2015-06-11 15:41:14

NegativeZero (76 views)
2015-06-11 09:49:18
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

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14
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!