Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


ic0de

Member Since 11 Nov 2010
Offline Last Active Apr 10 2015 09:00 PM

#4989564 Best way to filter for a bloom effect

Posted by ic0de on 12 October 2012 - 01:31 PM

I figured it out on my own and I must say It looks beautiful (although the effect seems to be fighting with my ssao). Anyway here is my solution.
if((0.2126*sample.r) + (0.7152*sample.g) + (0.0722*sample.b) > level)
{
  float brightenRatio = 1.0 / max(max(sample.r, sample.g), sample.b);
  sample.r *= brightenRatio;
  sample.g *= brightenRatio;
  sample.b *= brightenRatio;
}
else
{
  sample.r = 0.0;
  sample.g = 0.0;
  sample.b = 0.0;
}

The largest component ends up being 1.0 and the smaller components maintain the same ratio hence obtaining the same colour only brighter.


#4986966 Communicating with Programmers

Posted by ic0de on 04 October 2012 - 06:45 PM

Just make sure you know that something that may seem simple to you is not as simple in practice. They will probably tell you if you are asking for something that is too complex


#4984534 I want to be an indie game developer, where do I start?

Posted by ic0de on 27 September 2012 - 05:33 PM

Thanks this is really helpful, I have been watching some c++ tutorials lately, is this a bad idea? So far I understand everything.

Lot's of people will tell you C++ is not for beginners but it's in fact just fine. Since you already know JAVA you should breeze right through it anyway.

I recommend if the game is 3d that you use C++ & OpenGL & Bullet Physics
If the game is 2d then C++ & SDL

SDL is a library that does pretty much everything, control input, image loading, audio output, 2d graphics and more. It makes your code really portable because you need to make absolutely no OS specific calls.

I recommend you start with a platformer, that will teach you how a game works then you can move on to 3d if you so choose.


#4983875 [For a Beginner] C++ express 2010 or C++ express 2012?

Posted by ic0de on 25 September 2012 - 10:18 PM

Look guys (or girls) I don't know much of anything regarding programming (as I stated before) however what I do know is....

*C++ is the standard however it has a very steep learning curb (even worse for me since I'm a beginner)
*I had Java in the back of my mind for a while but I read (from other forums so don't take this as a solid point) that Java is rather dated

Since I was not so specific in my OP apparently let me ask a few other questions...

*What exactly is a library and how do I apply it into my programming?
*What is an engine? (I see on various games that it is powered by so and so's engine example - from what I understand it basically runs the code??)

Please stop arguing... because a lot of what I've read has gone over my head (obviously you know more than I on the matter)


A library is essentially a piece of code that someone else has written to perform various tasks for you, for example Bullet physics is a library that will do physics calculations so you don't have to. A library is usually a dll (on windows at least) that will be linked to your code.

An engine is similar to a library and some engines are libraries but mainly they perform the various functions of a game such as rendering and such so all you have to do is write game logic.

As for language choices, just continue with what you set out to do and don't let anyone tell you otherwise. The great part about c++ is that it can be as simple or as complex as you want it to be, c++ can even be c if you want it to. The learning curve of c++ is by no means steep. C++ also happens to be compatible with more third party libraries than most other languages. Its just a pleasure to use and definetly not a noose.

If you're smart and use libraries like SDL you could easily finish a pong game in two weeks.


#4983693 [For a Beginner] C++ express 2010 or C++ express 2012?

Posted by ic0de on 25 September 2012 - 01:33 PM

If you wanna use C++ (and I think you should) use VC++ 2010, I use it all the time and its great and functional and easy to use. I think the main thing new in visual studio 2012 is windows 8 integration and stuff, once windows 8 gets off the ground you should be able to move to the new IDE pretty simply by just importing your old solution files. Just letting you know that C++ was the first language I learned and it's not that hard, it's not an evil ogre like some people make it out to be, its a clean and elegant language and all kinds of third party libraries can extend its functionality. Just try C++ and if you think its too hard then switch to something else.


#4981855 Depth testing without the depth buffer

Posted by ic0de on 19 September 2012 - 04:43 PM

So I had this beautiful renderer that I wrote and then I decided to implement a particle system. The particles themselves work great but they conflict with my ssao shader because they write to the depth buffer during depth testing and end up causing an ugly shadow when ssao is reading from the depth buffer. I can solve this by disabling writing to the depth buffer but then my particles are not tested. Is there a way to depth test my particles without them being written into the depth buffer?


#4981105 Choosing a 2D game engine for my project

Posted by ic0de on 17 September 2012 - 07:53 PM

Allegro's free and it offers only outdated C code as a graphics wrapper.


Don't ever forget that C is C++. Any C is perfectly valid C++, and C isn't really outdated Its still used for a lot of modern programming.


#4981068 bilateral gaussian blur

Posted by ic0de on 17 September 2012 - 06:25 PM

In order to accomplish a bilateral blur you will need to use FBOs (Frame Buffer Objects). You essentially render your scene to an FBO and then blur that in one direction. You then render the first FBO to either another FBO or to the screen then you blur that in the other direction.

Your Shaders are going to look something like this, you will have two of them, each in a different direction.

uniform sampler2D color_texture;
varying vec2 vTexCoord;

const float blurSize = 1.0/512.0;

void main(void)
{
vec4 sum = vec4(0.0);
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y - 4.0*blursize)) * 0.05;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y - 3.0*blursize)) * 0.09;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y - 2.0*blursize)) * 0.12;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y - blursize)) * 0.15;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y)) * 0.16;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y + blursize)) * 0.15;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y + 2.0*blursize)) * 0.12;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y + 3.0*blursize)) * 0.09;
sum += texture2D(color_texture, vec2(vTexCoord.x, vTexCoord.y + 4.0*blursize)) * 0.05;
gl_FragColor = sum;
}



#4980362 C++, should I switch?

Posted by ic0de on 15 September 2012 - 07:22 AM

Oh, really? Please, do enlighten us on how you write GPU shaders. Do you cobble them together from C++ macros? Or perhaps you write them directly in IL assembly, hardcore-style? Also, how long does it take you to write a tool that replaces sequences of bytes in a binary buffer? Still waiting, cause in Python I'm done: buf.replace(). Oh, yours is... what? Faster? Oh, but I was only going to use it for a 10kb file anyway.


I'm sorry that came of so rudely but what I meant was for making games, yes scripting languages like python and javascript are great for doing small automation and I admit I use them from time to time, but if you are writing games the bulk of it is usually time critical and should be written in a fast language like c++, that said languages like GLSL are useful but they are incredibly application specific, they really just supplement other languages and not replace them.

More specifically c++ is in my opinion the best general purpose language for writing games.


#4980290 C++, should I switch?

Posted by ic0de on 14 September 2012 - 10:56 PM

Once you've programmed in a sane language, C++ feels SOOOOOOO much *more* painful. I need to make my own ??what??, to do what?? Really..... sheeesh.


C++ is the only sane language.

Once you know c++ there is no reason to use anything else. Unless of course you want the best speed possible in that case you would use assembly (sometimes I use it inline with c++ just for speed). As for making your own code for complicated things you can either have fun and do it yourself or use a third party library.

I tried learning JAVA, I decided it was just like c++ but slower and with too many rules.


#4977471 Framerate is low on Intel

Posted by ic0de on 06 September 2012 - 09:07 PM

Thanks. I'm a little reluctant to switch to VBOs at this point, especially if the gain won't be much.


VBO's look really complicated at first but start to make sense if you just take a half hour and really just study some example code you will get them. The performance gain will be massive if you are currently using glbegin/glend but if you are already using vertex arrays then it won't be huge but still measurable.

All in all glbegin/glend sucks for speed on anything.


#4905323 Anti-aliasing Techniques

Posted by ic0de on 22 January 2012 - 10:10 PM

many image based anti-aliasing methods handle all kinds of aliasing not just edges

look into FXAA:

http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf


#4892833 Define a plane knowing a point and the normal

Posted by ic0de on 11 December 2011 - 11:15 AM

I'm developing an opengl application and I have cast a ray from the camera to a point in 3D space. I would like to define a plane where such point lays, with the cast ray vector perpendicular to such plane.
Is it possible? If it's not clear I can make an image.


You should be able to define this plane if you know the tangent and the binormal, which can be derived from the normal.

We know that these vectors are both perpendicular to the normal. To find the tangent you will find two vectors perpendicular to the normal and pick one depending on whether the normal is positive or negative, the binormal will be the cross product of the tangent and the normal and at that point you should have enough information to define a plane, this will however be a massive burden on your CPU if you want to do this in real time so see if you can offload some calculations to the GPU using shaders or OpenCL.




#4889659 Orthographic projection issue

Posted by ic0de on 01 December 2011 - 08:28 PM

Hey everybody,

I have a 3D environment, created with JOGL (I'm using Eclipse) and now I want to create a simple 2D menu that the user can open by pressing "esc".

So I was thinking of using the orthographic projection. As I never used that projection, I tried looking up some sample code, but it just shows a black screen.

 GL2 gl = (GL2) drawable.getGL();

 gl.glMatrixMode(GL2.GL_PROJECTION);
 gl.glPushMatrix();
 gl.glLoadIdentity();
 gl.glOrtho(0, 500, 500, 0, 0, 1);
 gl.glScalef(1, -1, 1);
 gl.glTranslatef(0, -500, 0);
 gl.glMatrixMode(GL2.GL_MODELVIEW);
   
 gl.glColor3d(1.0, 1.0, 0.0);
 gl.glBegin(GL2.GL_QUADS);
    gl.glVertex2f(125, 125);
    gl.glVertex2f(125, 375);
    gl.glVertex2f(375, 375);
    gl.glVertex2f(375, 125);
 gl.glEnd();
 	
 gl.glMatrixMode(GL2.GL_PROJECTION); 
 gl.glPopMatrix(); 
 gl.glMatrixMode(GL2.GL_MODELVIEW);  

This is where I got the example code from: http://www.swiftless.com/tutorials/

Or do I need to search the mistake somewhere else?

Kind regards,
Dave


try gl.glTranslatef(0, -500, -1); instead of gl.glTranslatef(0, -500, 0); right now you are rendering it at the viewer and not in front of it.

also I would use glColor3f not glColor3d




PARTNERS