Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - lolz123

Pages: 1 ... 13 14 [15] 16 17 18
211
SFML projects / Gore Factor SFML
« on: October 05, 2011, 09:49:21 pm »
@meissner61: To clarify, the animation system interpolates certain key frames to get coordinates for sprites and other things such as depth, scale, alpha, and rotation. The sprites are then transformed according to these values, but the sprite itself is just a .png, not a vector image. I called this "vector animation" since it is similar to the motion tween feature in Flash. With it you can create smooth animations that don't look choppy when slowed down (useful for the slow motion feature). In addition, they use way, way less memory than sprite animations. The downside is that they are harder to animate and may run slower depending on the complexity of the animation.

212
SFML projects / Gore Factor SFML
« on: October 02, 2011, 04:36:48 am »
It is now time for Gore Factor to live up to its name!

You can now kill the zombies. So far, I only have the head shot "finisher", in which the zombie's head explodes.

I am posting it as a link, since it is kind of M rated now:

http://i1218.photobucket.com/albums/dd401/222464/GoreFactorGoreScreenie1.png

More to come! When the finishers for the zombies are all finished I will upload the next version.

213
SFML projects / Gore Factor SFML
« on: September 24, 2011, 04:10:08 pm »
Sure!

214
SFML projects / Gore Factor SFML
« on: September 24, 2011, 03:37:29 am »
Cool, I am honored! :)

215
SFML projects / Gore Factor SFML
« on: September 22, 2011, 11:56:35 pm »
@ Easy: Indeed, I have spent more time teching it up rather than adding content :)
Now that I have the shadows, though, I need to get them to run fast enough so that a larger variety of computers can handle them.
However, after that, there really isn't much more I want to add to the game engine, so I should be getting to creating game content soon. I got my map editor, Flash for animations, and event-based lua scripting ready to go.

216
SFML projects / Gore Factor SFML
« on: September 21, 2011, 11:20:08 pm »
An update: I am working on soft shadows which are physically accurate and not just blurred. Here is a screenshot of the shadow system so far:



I also plan on speeding up the algorithm some more through region queries that take the light angle into account and shadow occlusion.

217
Graphics / Shadow Occlusion Rendering
« on: September 14, 2011, 11:20:27 pm »
Hello,

I create a 2D dynamic shadows algorithm that uses a quad tree to store lights and shadow hulls.

For those unfamiliar with what 2D dynamic shadows are check this out:

http://archive.gamedev.net/archive/reference/articles/article2032.html

This allows me to quickly access which lights are affecting which hulls. However, I would now also like to do something similar to occlusion culling except with shadows.

If a hull is in a shadow of another hull, it doesn't have to render the shadow since it is already dark anyways. In the image below, the shadow of the shadow hull on the bottom left doesn't actually need to be rendered since it is in the shadow of the hull to the top left of it:



However, to do this effectively, I need to perform a "reverse painter" algorithm with the quad tree somehow, where things closer to the light are drawn first. Any ideas on how to do this would be helpful.

Also, for the shadow occlusion itself, is there a way to detect if a certain z buffer value is currently in a particular region in the z buffer? I believe that that this is how hardware accelerated occlusion culling systems work, but I do not know how to do it in OpenGL.

Any help would be appreciated.

[EDIT]:

Well, I found out a way to do the occlusion culling part. However, the problem of sorting the objects according to the distance from the light source still remains.

218
SFML projects / Gore Factor SFML
« on: September 08, 2011, 02:32:42 am »
Source is up now, as well as the map editor (comes with instructions).

@ keyforge: I am using Box2D for they physics, so I just added box-shaped bodies. However, to keep the body count down, I made it stretch the boxes horizontally as long as there was a row of consecutive "solid" tiles. See the source file for Entity_TileMap for more information.

219
Graphics / [HELP]SFML Sprite with Box2D
« on: August 28, 2011, 11:24:40 pm »
I usually use OpenGL directly, but this should work:

Code: [Select]
sf::Image img;
img.LoadFromFile("bla.png");
sf::Sprite s(img);

// Set origin to center
s.SetOrigin(img.GetWidth() / 2.0f, img.GetHeight());
b2BodyDef d;

// Adjust body def settings...

b2Body* b;
b = pWorld->CreateBody(&d);

// Apply a fixture...

b2Vec2 pos = b->GetWorldCenter();

s.SetPosition(pos.x * physicsDrawScale, pos.y * physicsDrawScale);
s.SetRotation(b->GetAngle() * (180.0f / PI));
appWindow.Draw(s);


Just make sure that your sprite's center corresponds to the center of the shape. If you do not have a symmetrical shape, you may have to get the center of mass instead of the plain center.

220
SFML projects / Gore Factor SFML
« on: August 27, 2011, 04:54:02 pm »
Probably within the next 48 hours!

221
SFML projects / Gore Factor SFML
« on: August 27, 2011, 04:41:07 am »
I took the code for the old version down, new version is going up soon.

EDIT: I forgot to add, the new version will come with a map editor. The map editor is not written using SFML though, I got lazy and use Java Swing.

222
Graphics / SFML 2 Water Shader Problem
« on: August 27, 2011, 04:26:44 am »
I figured it out, it was the texture coordinates as I originally predicted. I also changed some stuff in the code that draws the water so that the "waves" move with the scene and not with the camera (with the camera meaning not at all).

@ Groogy: Thanks for the site, it was very helpful!

 Here is the finished effect:



If anyone else ever wants to use this effect, here is the shader (didn't change much):

Code: [Select]
uniform sampler2D screenTex;

uniform sampler2D noiseTex;

uniform float time;

uniform float waterTexX;
uniform float waterTexY;

void main()
{
// Get the color of the noise texture at a position the current fragment position offset by the time
vec4 noiseTexCol = texture2D(noiseTex, vec2(gl_TexCoord[0].x + waterTexX + time, gl_TexCoord[0].y + waterTexY + time));

// Reduce the offset
float reducedOffset = (.5 - noiseTexCol.x) / 70;

// Get the color of the screen at the offset location and set it as the fragment color
gl_FragColor = texture2D(screenTex,  gl_TexCoord[0].xy + vec2(reducedOffset, reducedOffset));
}


And here is the code that rendered it (this part changed):

Code: [Select]
// First render the water texture
waterTexture.Bind();

glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f(renderPos.x - renderDims.x, renderPos.y - renderDims.y, 0.0f);
glTexCoord2f(tilingWaterTextCoordUpper.x, 0); glVertex3f(renderPos.x + renderDims.x, renderPos.y - renderDims.y, 0.0f);
glTexCoord2f(tilingWaterTextCoordUpper.x, tilingWaterTextCoordUpper.y); glVertex3f(renderPos.x + renderDims.x, renderPos.y + renderDims.y, 0.0f);
glTexCoord2f(0, tilingWaterTextCoordUpper.y); glVertex3f(renderPos.x - renderDims.x, renderPos.y + renderDims.y, 0.0f);
glEnd();

// Render the water shape with the shader applied
sf::Image screen;
screen.CopyScreen(appWindow);
waterShader.SetTexture("screenTex", screen);
waterShader.SetParameter("time", time / 256.0f);
waterShader.SetParameter("waterTexX", Wrap(camera->x / window_width, 256.0f));
waterShader.SetParameter("waterTexY", Wrap(camera->y / window_height, 256.0f));

glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);

renderPos = Vec2f(physicsPos.x * physicsDrawScale, physicsPos.y * physicsDrawScale);

waterShader.Bind();

Vec2f difference = renderPos - *camera - renderDims;
Vec2f lower(difference.x / window_width, difference.y / window_height);
Vec2f higher = lower + shaderTextCoordDims;

glBegin(GL_QUADS);
glTexCoord2f(lower.x, lower.y); glVertex3f(renderPos.x - renderDims.x, renderPos.y - renderDims.y, 0.0f);
glTexCoord2f(higher.x, lower.y); glVertex3f(renderPos.x + renderDims.x, renderPos.y - renderDims.y, 0.0f);
glTexCoord2f(higher.x, higher.y); glVertex3f(renderPos.x + renderDims.x, renderPos.y + renderDims.y, 0.0f);
glTexCoord2f(lower.x, higher.y); glVertex3f(renderPos.x - renderDims.x, renderPos.y + renderDims.y, 0.0f);
glEnd();

waterShader.Unbind();

glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);


Thanks for the help!

223
Graphics / SFML 2 Water Shader Problem
« on: August 22, 2011, 03:02:56 am »
Well, has a texture to work with, since it remains not only white but changes colors to the colors of pixels on screen (sometimes red when it is reading the texture at the player's shirt, for example). Also, disabling textures in the main program does not disable them for the shader. That is why I think the texture coordinates in the shader are wrong, but since I do not really understand GLSL texture coordinates, I do not know what to change in the code.

224
Graphics / SFML 2 Water Shader Problem
« on: August 22, 2011, 02:35:09 am »
Well, the distortion effect works full-screen, just not on that small box. It doesn't use what is being drawn as the source for the distortion texture, it uses what has currently been draw on screen (in my game engine shaders get drawn last). I think the coordinates for the textures in GLSL are messed up somehow, I just don't know how exactly.

225
Graphics / SFML 2 Water Shader Problem
« on: August 22, 2011, 12:42:08 am »
@ Easy: That was the idea!

@ epaik: I am using OpenGL directly, so it is neither. Otherwise the whole binding the effect thing wouldn't work.

Pages: 1 ... 13 14 [15] 16 17 18