Search found 24 matches

by Viking86
Sat May 15, 2010 2:48 pm
Forum: Advanced Help
Topic: A question about binormals and tangents (shader related)
Replies: 0
Views: 721

A question about binormals and tangents (shader related)

Greetings, thanks to some great people here I've managed to implement relief mapping using shader code from the Typhoon Labs shader designer.

Now with only changin the code for getting the binormal and tangent
eyeSpaceTangent = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz);
eyeSpaceBinormal ...
by Viking86
Fri May 14, 2010 1:16 pm
Forum: Beginners Help
Topic: Displaying a dynamic variable on screen
Replies: 4
Views: 564

Re: Displaying a dynamic variable on screen

how do I pass a float variable to the setText function?

irr::gui::IGUIStaticText myText = guienv->addStaticText(L"", ...);
//....
myText->setText(irr::core::stringw(myFloatVariable).c_str());

Thank you very much
irr::gui::[b]IGUIStaticText*[/b] myText = gui->addStaticText(L"",core::rect<s32 ...
by Viking86
Wed May 12, 2010 12:51 pm
Forum: Beginners Help
Topic: Displaying a dynamic variable on screen
Replies: 4
Views: 564

Displaying a dynamic variable on screen

Greetings , whats the easiest way to show a changing variable on screen ?, I have a global variable which is changable during the program run time.
I simply want to have a display of the variables current value in the window.

I looked at the tutorial 9 which had something similar
gui->addEditBox ...
by Viking86
Sat May 08, 2010 11:36 am
Forum: Beginners Help
Topic: Changing a uniform shader variable on the fly?
Replies: 5
Views: 1067

Thank you, I made it like this
declare a global variable for the parameter
pass that variable as a uniform to the shader

Make an event receiver in which key presses modify the global variable.
Voila :)
by Viking86
Fri May 07, 2010 4:53 pm
Forum: Beginners Help
Topic: Changing a uniform shader variable on the fly?
Replies: 5
Views: 1067

Changing a uniform shader variable on the fly?

Is it possible, I was planing to combine the slidebar from the tutorial no.5 with a shader. So that when that the user moves the slidebar the parameters of the shader change.

Can this be done?
by Viking86
Fri May 07, 2010 4:27 pm
Forum: Advanced Help
Topic: Normals in RGB, heightmap in Alpha, passing to shader
Replies: 12
Views: 4338

Thank you very much, If you are ever in croatia (or I in spain) you have a drink on me

OMG That is done :wink:

The relief mapping, is somewhat slow (or too slow).
The alternative that looks like "something", is the Parallax occlusion mapping but it is another thing.

Your code is an example ...
by Viking86
Wed May 05, 2010 12:24 pm
Forum: Advanced Help
Topic: Normals in RGB, heightmap in Alpha, passing to shader
Replies: 12
Views: 4338

Thank you very much, If you are ever in croatia (or I in spain) you have a drink on me :)

But I was trying to implement relief mapping, not parallax mapping :)
The fragment shader is long :)
uniform vec4 fvAmbient;
uniform vec4 fvSpecular;
uniform vec4 fvDiffuse;
uniform float fSpecularPower ...
by Viking86
Mon May 03, 2010 11:43 am
Forum: Advanced Help
Topic: Normals in RGB, heightmap in Alpha, passing to shader
Replies: 12
Views: 4338

Remember that Irrlicht stores the information on tangents and binormal of differently type.

ONLY OPENGL

for Tangent:
vec3 t = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz);
for Binormal:
vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz);

Also, remember to convert the mesh to ...
by Viking86
Sun May 02, 2010 3:31 pm
Forum: Advanced Help
Topic: Normals in RGB, heightmap in Alpha, passing to shader
Replies: 12
Views: 4338

sampler2D means texture (don't know if you can use it for other things but I think you can't), and services->setPixelShaderConstant("baseMap", (float*)(&baseMap), 1); doesn't set a texture, it sets just one float (4 bytes) on that texture - entry.
Check out the link as Bate seems to have done the ...
by Viking86
Sat May 01, 2010 12:10 pm
Forum: Advanced Help
Topic: Normals in RGB, heightmap in Alpha, passing to shader
Replies: 12
Views: 4338

Not intending to hijack the thread, but how exactly does the base material for a shader work? Doesn't the shader override the base material?
I don't think it does in a complete sense, for example try putting a transparent material type as a base, you will get a transparent effect on your texture ...
by Viking86
Fri Apr 30, 2010 4:37 pm
Forum: Advanced Help
Topic: Normals in RGB, heightmap in Alpha, passing to shader
Replies: 12
Views: 4338

Normals in RGB, heightmap in Alpha, passing to shader

Greetings, I have a shader in which it passes a texture in 1, and the normals and heightmap in the second picture.
Thanks to some great people here i know how to pass textures to the shader
int baseMap=0;
services->setPixelShaderConstant("baseMap", (float*)(&baseMap), 1);
int reliefMap=1;
services ...
by Viking86
Thu Apr 29, 2010 1:56 pm
Forum: Advanced Help
Topic: 5-Light Phong Shader Material
Replies: 6
Views: 1085

It may be similar to the problem i had recently, I get shader linking errors on my new pc, but on my laptop with an old radeon the errors are not there and it runs. In my case the reason was an old opengl texture function, so it may be a driver issue with you as well.
by Viking86
Tue Apr 27, 2010 1:46 pm
Forum: Advanced Help
Topic: Passing a texture to a shader
Replies: 9
Views: 1841

In the example you take a mesh without tangents and use the mesh manipulator to create a duplicate mesh with tangents, but notice how in the tutorial itself, CD3D9ParallaxMapRenderer.cpp, and COpenGLParallaxMapRenderer.cpp, there's nothing that sets the tangents in a shader callback or anything ...
by Viking86
Tue Apr 27, 2010 1:01 pm
Forum: Advanced Help
Topic: Passing a texture to a shader
Replies: 9
Views: 1841

Tangents, normals, and the like should be passed in automatically since that data is coming from the vertices themselves. To set other things, you use a class derived from IShaderConstantSetCallBack and set the data with IMaterialRendererServices functions. See the shader example for details.
I ...
by Viking86
Mon Apr 26, 2010 3:09 pm
Forum: Advanced Help
Topic: Passing a texture to a shader
Replies: 9
Views: 1841

Thank you in you replies :)

now going through the shader code there are a few more things these particular shaders need.

uniform vec4 Tangent;
uniform vec4 Normal;
uniform vec4 BiNormal;

uniform vec4 Eye; //eye coord
varying vec3 EyeDir; // eye vector direction

I know how to get these in opengl ...