irrCg v0.8 (Initial) - CgFX (Texture States, MultiPass etc.)
You may need to send transposed matrices or switch from matrix*vector to vector*matrix. Output a solid Red colour in your PS to see if projection is correct (unless you're background is Red ).
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
Yes, it worked, thanks.
Here's the code again:
The rendermonkey solution: www.orandysoftware.com/user_files/normal.zip
Now comes the pixel bit. In rendermonkey, half of the cube displayed the diffues color like a gradient instead of the textures. I tried loading it in irrlicht and the cube has the specularmap as the diffuse texture, with bumpmap (it seems there's a constant light).
Could someone test to see if it's the shader's problem or the callbacks.
Loads of thanks.
Here's the code again:
Code: Select all
float4 lightPosition; // Object Space
float3 eyePosition; // Object space
float4x4 WorldViewProj;
void vsmain(float4 Position: POSITION,
float3 Normal: NORMAL,
float2 Uv: TEXCOORD0,
float3 Tangent: TEXCOORD1,
float3 Binormal: TEXCOORD2,
out float4 oPosition: POSITION,
out float2 oUv: TEXCOORD0,
out float3 oLightDir: TEXCOORD1, // Tangent Space
out float3 oEyeDir: TEXCOORD2, // Tangent Space
out float3 oHalfAngle: TEXCOORD3 // Tangent Space
)
{
oPosition = mul(Position, WorldViewProj);
oUv = Uv;
float3 LightDir = normalize(lightPosition.xyz - (Position * lightPosition.w));
float3 EyeDir = eyePosition - Position.xyz;
float3x3 TBN = float3x3(Tangent, Binormal, Normal);
// Transformacja do Tangent Space
LightDir = normalize(mul(TBN, LightDir));
EyeDir = normalize(mul(TBN, EyeDir));
oLightDir = LightDir;
oEyeDir = EyeDir;
oHalfAngle = normalize(EyeDir + LightDir);
}
float3 LightDiffuse;
sampler2D DecalMap: register(s0);
sampler2D NormalMap: register(s1);
sampler2D SpecularMap: register(s2);
/* Parallax Mapping
uniform sampler2D HeightMap,*/
void psmain(float2 Uv: TEXCOORD0,
float3 LightDir : TEXCOORD1,
float3 EyeDir : TEXCOORD2,
float3 HalfAngle : TEXCOORD3,
out float4 oColor : COLOR)
{
float2 TexCoord;
/* Parallax Mapping
float Height = tex2D (HeightMap, Uv).r;
Height = Height * 0.04 - 0.02;
float3 Eye = normalize (EyeDir);
TexCoord = (Height * Eye.xy) + Uv;
*/
// else
TexCoord = Uv;
float3 Normal = 2.0 * tex2D (NormalMap, TexCoord).rgb - 1.0;
Normal = normalize (Normal);
// Œwiat³o rozproszenia
float3 Diffuse = max (dot (LightDir, Normal), 0.0) * LightDiffuse;
float3 DecalColor = tex2D (DecalMap, TexCoord).rgb;
float3 SpecularColor = tex2D(SpecularMap, TexCoord).rgb;
float Specular = max (dot (HalfAngle, Normal), 0.0);
Specular = pow (Specular, 8.0);
oColor = float4 (DecalColor * Diffuse + Specular * SpecularColor, 1.0);
}
Now comes the pixel bit. In rendermonkey, half of the cube displayed the diffues color like a gradient instead of the textures. I tried loading it in irrlicht and the cube has the specularmap as the diffuse texture, with bumpmap (it seems there's a constant light).
Could someone test to see if it's the shader's problem or the callbacks.
Loads of thanks.
-
- Posts: 168
- Joined: Sun Feb 04, 2007 3:30 pm
- Location: France
I LOVE YOU !
now i can write my desired CG editor and kick in the ass the FxComposer, it's too damned heavy =P
umhhh, i saw that cg.dll compiles the program, but enabling it in Irrlicht ?
umhh, i saw it too complicated, Irrlicht design is not too plugin based...
now i will have my own editor yeahhh
Au Revoir =P
now i can write my desired CG editor and kick in the ass the FxComposer, it's too damned heavy =P
umhhh, i saw that cg.dll compiles the program, but enabling it in Irrlicht ?
umhh, i saw it too complicated, Irrlicht design is not too plugin based...
now i will have my own editor yeahhh
Au Revoir =P
My Gramathicalz horrorz are precalkulated, zo Zhut Up !
_______
Bah, actually my english is poor, but...
forget it xDDDD
_______
Bah, actually my english is poor, but...
forget it xDDDD
Have You got problem with compile examples? Have You got properly configure Code::Blocks with MS Platform SDK? Maybe You have bad configure project in MS Visual 2005? What Errors You have got in compilation procces?Steel Style wrote:HUm I have 3 five error, 3 conflict between msvprtd.lib and chernolbylShaderFREE.lib , and one error about extern. How can I do ?
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Sounds like he is using "Multi Threaded DLL" or "Multi Threaded" wrongly in the Code Generation settings.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 168
- Joined: Sun Feb 04, 2007 3:30 pm
- Location: France
Actually I don't work even more on my code before compile yours and I have this error. I use MVS 2005
Erreur 1 error LNK2019: symbole externe non résolu "class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *,char const *)" (?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@PBD@Z) référencé dans la fonction _main main.obj
Erreur 1 error LNK2019: symbole externe non résolu "class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *,char const *)" (?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@PBD@Z) référencé dans la fonction _main main.obj
Its a linker error, not run-time, and its for an unresolved external (If my spanish is any good). So I think he just forgot to link the irrlicht lib.
Try:
Try:
Code: Select all
pragma comment(lib,"irrlicht.lib");
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 168
- Joined: Sun Feb 04, 2007 3:30 pm
- Location: France
Version 0.5 of Cg Binding for Irrlicht was done! Project has got new name - "IrrCg". With current version You can easy create Cg Shader, similar to create Irrlicht standard shaders per Callback, because it is full integrated with Irrlicht functions:) Now You can use Cg Shaders per Irrlicht Material. You can easy convert HLSL Irrlicht Shaders to Cg Shaders. I update all examples to new interface, so You can see than use Cg in Irrlicht is VERY, VERY EASY! First post update for downloads;) I'm waiting for comments:)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
-
- Posts: 914
- Joined: Fri Aug 03, 2007 12:43 pm
- Location: South Africa
- Contact:
hey nadro, i updated the link in ur space here,
http://nadro.owned.co.za/IrrCg_v0_5.zip
for anyone here it is too. i HATE the stupid share file services
http://nadro.owned.co.za/IrrCg_v0_5.zip
for anyone here it is too. i HATE the stupid share file services
Big thanks FuzzYspo0N for upload!
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes