Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

japro

Member Since 25 Aug 2009
Offline Last Active Today, 04:10 AM
*****

#4971018 Lighting in caves

Posted by japro on 18 August 2012 - 11:45 PM

What I did here: http://pic.twitter.com/foX0EZvS was trace a bunch of rays for each surface. The Minecraft thing is essentially a special case of the ray tracing where you only use a single ray pointing straight up. The Problem with this is that its pretty expensive and it becomes fairly hard to determine what has to be updated when a single block is removed and you end up updating a whole bunch of surrounding blocks etc.
From a results point of view this look very nice though. I spent a lot of time thinking about optimizations like mipmapping the terrain and use that to accelerate the raytracing etc. But the problem is always that you will miss some sort of detail when doing that (thin walls become transparent etc.).


#4970374 OpenGL Texture Blur?

Posted by japro on 16 August 2012 - 05:30 PM

Set GL_TEXTURE_MAG_FILTER to GL_NEAREST instead of GL_LINEAR.


#4967024 OpenGL 4.3 - compute shaders and much more

Posted by japro on 07 August 2012 - 08:44 AM

You guys are no fun Posted Image. I was having so much fun with compute shaders (actually, still have Posted Image).
gravitational n-body: https://github.com/progschj/OpenGL-Examples/blob/master/experimental/XXcompute_shader_nbody.cpp


#4966735 OpenGL 4.3 - compute shaders and much more

Posted by japro on 06 August 2012 - 11:59 AM

OpenGL 4.3 is here:
http://www.khronos.o...or-enhancements

specs:
http://www.opengl.org/registry/

Beta drivers from Nvidia:
http://www.nvidia.co...driver-4.3.html

And I obviously had to quickly try out compute shaders:
https://github.com/p...pute_shader.cpp

Yay! Posted Image


#4965822 "Seeding" Multiplayer Games?

Posted by japro on 03 August 2012 - 06:30 AM

Isn't Day Z partly peer to peer based? One obvious issue with the torrent comparison is that torrents most likely don't care about latency and in a "graph" of peers the total usable bandwidth is actually higher than with a central host, while the same doesn't hold at all for latency. Well actually it sort of does since the latency via multiple peers is generally "higher" which is not what you want at all.


#4965663 Best Practices With Templates

Posted by japro on 02 August 2012 - 04:33 PM

Correct. In C++11 you can somewhat emulate something like that though by using a "factory function" and the auto keyword.

template<class T>
struct Holder {
   Holder(T value) : value(value) { }
   T value;
};

template<class T>
Holder<T> make_holder(T value)
{
   return Holder<T>(value);
}

//...

auto myholder1 = make_holder(3.15);
auto myholder2 = make_holder(42);
//...



#4965197 So I started writing Example Programs

Posted by japro on 01 August 2012 - 07:26 AM

Today I had some fun with ARB_shader_image_load_store (core in 4+): https://github.com/p..._load_store.cpp
It solves the electromagnetic wave equation on a 2d grid with shaders. Thanks to the extension the update can be done in place so there is no fbo ping pong rendering required. Just a single texture.
wave_equation.png


#4964466 Compressing vertex attribute normals

Posted by japro on 30 July 2012 - 06:31 AM

I think what he meant is store two components (x,z) and then get the third one from y = sqrt(1-(x^2+z^2)). that doesn't give you the sign of y but for example in a heightfield you can usually assume that the y component has to point "up".


#4964130 Best Practices With Templates

Posted by japro on 28 July 2012 - 05:10 PM

You usually don't have to provide an explicit template argument. The compiler will deduce that for you if possible... So there is usually no syntactical overhead with function templates.
template<class T>
bool IsWithin(T number, T min, T max ) { /*...*/ }

int a,b,c;
double d,e,f;
isWithin(a,b,c); // ok
isWithin(d,e,f); // ok
isWithin(a,e,f); // here the compiler will complain since it cant figure out which type to choose for T
isWithin<double>(a,e,f); // ok

To restrict the types a template will "accept" look at boost::enable_if (or std::enable_if if you are using c++11)


#4964109 Learning Open GL Advanced Features

Posted by japro on 28 July 2012 - 03:48 PM

I personally would still concentrate on 3+. The reason being that using 2.x after understanding 3+ is really easy while going from 2 -> 3 there is a high chance that you have to "unlearn" things that got deprecated in newer versions. Using pure programmable pipeline also has the advantage that it exposes more of the inner workings as opposed to the "easy" blackbox that is fixed function/matrix stack. It's just more transparent.


#4963082 So I started writing Example Programs

Posted by japro on 25 July 2012 - 04:19 PM

I just added the first OpenGL 4 example. It shows tessellation: https://github.com/p...tesselation.cpp

It also has a simple phong lighting implementation and is funny in that it doesn't use a vbo at all. It generates the sample points by "abusing" instanced rendering and only uses gl_VertexID and gl_InstanceID and the texture as inputs so to speak.

Here is a video:


#4961281 make games using eclipse?

Posted by japro on 20 July 2012 - 05:56 AM

Yes


#4961185 Particle System...

Posted by japro on 19 July 2012 - 11:14 PM

I have some very bare bones code here: https://github.com/p...OpenGL-Examples
examples 07-09 are particle system to some extent. There isn't a whole lot to it actually... just just draw lots of billboarded quads at the particle positions. Everything else like how you want the particles to move, be shaded etc. is up to you. In that code up there I use a geometry shader for the rendering, you could just as well use instancing or even explicit quads.


#4961182 Hardware Occlusion Queries, why use them next frame?

Posted by japro on 19 July 2012 - 11:09 PM

At least OpenGL has conditional render which in theory would allow the occlusion queries also to stay on the GPU. I found this to work reasonably well on new hardware (gtx560ti) but very badly on my gtx260m. On the new hardware using the conditional render in the same pass as the queries gave me a speed up of factor 1.5-5 depending on the amount of occlusion. But it would actually reduce performance on the older GPU.

I have an example of this here: https://github.com/p...onal_render.cpp

Edit: DX seems to have this functionality as well I just wasn't sure at the point of writing the post since I'm not really experienced with DX


#4960966 Any way Render to VBO directly?

Posted by japro on 19 July 2012 - 09:15 AM

I have a transform feedback example in my examples: https://github.com/progschj/OpenGL-Examples/blob/master/09transform_feedback.cpp




PARTNERS