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 - WitchD0ctor

Pages: 1 2 [3] 4 5 ... 7
31
SFML projects / Gore Factor SFML
« on: April 14, 2011, 06:48:10 am »
awesome, im also working on a sidescrolling platformer with box2d,

how did you make it so that he can tell when its ok to jump?

32
General / Unresolved linker externals
« on: April 07, 2011, 06:37:41 am »
I'm having the same issues you are, (more or less)
trying to use a new build, but when i compile my project using it, i get a re-donk-you-less, amount of linking errors, was about to post the same question so an answer to this would be sweet.

33
Graphics / Blending shadows correctly
« on: March 13, 2011, 07:38:04 pm »
Quote from: "Laurent"
There's a source code on the wiki for a complete light manager:
http://www.sfml-dev.org/wiki/fr/sources/lightmanager

The page is in french but you should be able to use the code.

And it's for SFML 2.


what??? That is awesome, wish I knew that was there before

34
Feature requests / Sf::clock pause?
« on: March 13, 2011, 09:44:59 am »
This is exacly what I'm looking for, thanks!

35
Feature requests / Sf::clock pause?
« on: March 13, 2011, 04:38:46 am »
Just a thought but a pause and resume function for the clock Class would be kind of useful for me, not sure how difficult it would be to add but it doesn't seem too hard.

Any body agree this would be kind of nice?

36
SFML projects / sigui = Simple Includable GUI
« on: March 04, 2011, 01:01:18 am »
Im feeling adventures, so any guidance you can offer would be appreciated, I'll just take a gander at the header file and your example above until then!

37
Graphics / SFML 1.6 to SFML 2.0 porting failure
« on: March 04, 2011, 12:53:34 am »
What Nexus said, basically what that means for you is that instead of
Code: [Select]

int left = tile->tx;
int right = left + 16;
int top = tile->ty;
int bottom = tile->ty + 16;


for right and bottom, you can just do

Code: [Select]

int left = tile->tx;
int right = 16;
int top = tile->ty;
int bottom = 16;

38
SFML projects / sigui = Simple Includable GUI
« on: March 03, 2011, 06:11:30 am »
Looks pretty awesome, do you have a download link so we could help test it out?

39
Graphics / [GLSL] Normal/Specular Maps
« on: March 03, 2011, 04:45:40 am »
anyone?

40
Graphics / [GLSL] Normal/Specular Maps
« on: February 27, 2011, 11:50:49 am »
Prerequisite: I'm Using SFML2 on Windows 7 Professional 64 bit (but compiling with 32)


Hey, Im finally trying to implement lighting in my game. What im trying to do is a simple test to see if i can load a simple brick diffuse texture, and display it with a  point light at the mouse position. I also want to use a Normal and Specular map to control how the light reacts to the Material.

The problem is when searching for examples on how to approach this, most tutorials are aimed for 3d Surfaces, so it involves a vertex shader as well as a fragment shader, but I would like to implement the lighting using only the  sf::Shader's class provided by SFML.

So far I have managed to load and feed the required maps to the shader, however im not sure where to continue from here, as im missing some data that the vertex shader is suppose to provide, here is a link to the original shader from the tutorial.

http://ciardhubh.de/node/18


another thing to note is, im not sure about is how im suppose to modify

Code: [Select]
uniform lightDataType light;
from my application, do I make a similar structure? What do I replace the vec4's with?

Any way after some reworking, I hacked up a version of the above that, Kind of, almost works, but not quite,
Code: [Select]

[source]



struct lightDataType
{
    vec4  ambient;
    vec4  diffuse;
    vec4  specular;
    vec4  position;
};


uniform float time;
uniform float mouseX;
uniform float mouseY;





uniform float shininess; // Shininess exponent for specular highlights

uniform sampler2D diffuseTexture;
uniform sampler2D normalMap;
uniform sampler2D specularMap;


void main(void)
{

vec4 light_ambient = vec4(.5, .5, .5, 1);
vec4 light_position = vec4(mouseX, mouseY, .1, 0);
vec4 light_diffuse = vec4(.5, .5, .5, 1);
vec4 light_specular = vec4(0.2, 0.2, 0.2, 1);


vec3 tbnDirToLight = normalize(light_position-texture2D(normalMap, gl_TexCoord[0].xy).xyz); // Direction to light in tangent space...I think
vec3 tbnHalfVector = normalize(vec3(0, 0, -1)); // Half vector in tangent space


    // Base colour from diffuse texture
    vec4 baseColour = texture2D(diffuseTexture, gl_TexCoord[0].xy);

    // Uncompress normal from normal map texture
    vec3 normal = normalize(texture2D(normalMap, gl_TexCoord[0].xy).xyz * 2.0 - 1.0);
    // Depending on the normal map's format, the normal's Y direction may have to be inverted to
    // achieve the correct result. This depends - for example - on how the normal map has been
    // created or how it was loaded by the engine. If the shader output seems wrong, uncomment
    // this line:
    // normal.y = -normal.y;
   
    // Ambient
    vec4 ambient = light_ambient * baseColour;
   
    // Diffuse
    // Normalize interpolated direction to light
    vec3 tbnNormDirToLight = normalize(tbnDirToLight);
    // Full strength if normal points directly at light
    float diffuseIntensity = max(dot(tbnNormDirToLight, normal), 0.0);
    vec4 diffuse = vec4(0.0, 0.0, 0.0, 0.0);

    // Specular
    vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);
    // Only calculate specular light if light reaches the fragment.
    if (diffuseIntensity > 0.0) {
        // Colour of specular reflection
        vec4 specularColour = texture2D(specularMap, gl_TexCoord[0].xy);
        // Specular strength, Blinn–Phong shading model
        float specularModifier = max(dot(normal, normalize(tbnHalfVector)), 0.0);
        specular = light_specular * specularColour * pow(specularModifier, shininess);


diffuse = light_diffuse * baseColour * diffuseIntensity;


    }

    // Sum of all lights
    gl_FragColor = clamp(ambient + diffuse + specular, 0.0, 1.0);
   
    // Use the diffuse texture's alpha value.
    gl_FragColor.a = baseColour.a;
}


[/source]



The Result:

 
Not much Going on :S
The biggest problem probably is that Im not sure what to put for
Code: [Select]
vec3 tbnDirToLight
and
Code: [Select]
vec3 tbnHalfVector'



Id appreciate any help somebody with knowledge of GLSL can give me!

41
General / How to write text on screen - SFML2
« on: February 26, 2011, 07:04:20 am »
its been renamed, all you need to change is,

sf::String to sf::Text,


and change .SetSize to .SetCharacterSize,
and it should work as expected

42
Audio / Music Slicing
« on: February 08, 2011, 01:17:15 pm »
UHH, in real time using SFML? I dont think so, Maybe using an audio editing program like audacity, even then that might be a bit of a difficult task.

43
You should fix your link!

44
SFML projects / HyperNova
« on: December 20, 2010, 02:04:19 am »
heh, i think he shouldn't get stuck in walls!

45
SFML projects / HyperNova
« on: December 19, 2010, 04:49:08 pm »
ya,  they have kind of high linear damping though, thats why they fall so slow, this way you can kind of still use them as a platform, but you have to use them quickly, or they will fall too far

Pages: 1 2 [3] 4 5 ... 7
anything