Hardware Skinning for Irrlicht 1.7

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.

Postby trivtn » Mon Nov 29, 2010 1:05 am

Thanks christianclavet !
I've tried it !
DX with : 368
Dx without : 128
--
OpenGl with : 268
OpenGl without : 120
I'll install HW in my project ! many thanks !
There's something is fantastic, there's nothing is absolute.
trivtn
 
Posts: 129
Joined: Tue Jan 17, 2006 12:30 pm
Location: Viet Nam

Postby lazerblade » Mon Nov 29, 2010 4:29 am

Am I the only one getting shader compilation errors here? :sad:


Loaded mesh: dwarf.x
Joint Num: 46, current limit is 55 joints.
GLSL shader failed to compile
ERROR: 0:17: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:17: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:18: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:18: '[]' : integer expression required
ERROR: 0:20: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:20: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:21: '>' : wrong operand types no operation '>' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:22: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:22: '[]' : integer expression required
ERROR: 0:24: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:24: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:25: '>' : wrong operand types no operation '>' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:26: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:26: '[]' : integer expression required
ERROR: 0:28: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:28: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:29: '>' : wrong operand types no operation '>' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:30: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:30: '[]' : integer expression required
ERROR: 0:32: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:34: 'constructor' : constructing matrix from matrix (reserved)
ERROR: 0:34: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:40: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:41: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:42: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:43: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 26 compilation errors. No code generated.



I'm compiling with eclipse using MinGW GCC. Does that make any difference?

If it does, we'll tar and feather you for writing platform dependent code for a cross platform engine. :lol:


Here's the relevant source code if it helps.
Scene = what would normally be 'smgr'
and irrlicht = what would normally be 'device'


Code: Select all

IAnimatedMeshSceneNode* dwarf = Scene->addAnimatedMeshSceneNode(Scene->getMesh("dwarf.x"));
   dwarf->setScale(vector3df(1,1,1));
   dwarf->setMaterialFlag(EMF_LIGHTING, true);
   HWSkinCB::getInstance()->setupNode(irrlicht,dwarf,30);



I'm using christianclavet's latest version.
LazerBlade

When your mind is racing, make sure it's not racing in a circle.

3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
lazerblade
 
Posts: 194
Joined: Thu Mar 18, 2010 3:31 am

Postby lazerblade » Mon Nov 29, 2010 4:38 am

Aw snap!

I just found that when I run the demo and select to use OGL rendering, I get the same errors unless I disable HW skinning. The payload BTW, is that all the meshes appear dark. Probably because they're unlit.

Here's the full output of the demo:

Dx or Ogl?
1.Dx
2.Ogl
2

Activate the hardware skinning?
1.Yes
2.No
3.Disable skinning
1

Enable Lighting?
1.Yes
2.No
1

Joint Num: 46, current limit is 55 joints.
Irrlicht Engine version 1.7.2
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Using renderer: OpenGL 2.0.5077
MOBILITY RADEON X300 x86/SSE2: ATI Technologies Inc.
OpenGL driver version is 1.2 or better.
GLSL version: 1.1
Loaded texture: E:/lazerbladegames/Irrlicht/hwSkin/24. Hardware Skinning/axe.jpg
Loaded texture: E:/lazerbladegames/Irrlicht/hwSkin/24. Hardware Skinning/dwarf.jpg
Could not open file of texture: dwarf2.jpg
Loaded mesh: dwarf.x
GLSL shader failed to compile
ERROR: 0:17: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:17: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:18: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:18: '[]' : integer expression required
ERROR: 0:20: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:20: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:21: '>' : wrong operand types no operation '>' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:22: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:22: '[]' : integer expression required
ERROR: 0:24: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:24: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:25: '>' : wrong operand types no operation '>' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:26: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:26: '[]' : integer expression required
ERROR: 0:28: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:28: 'assign' : cannot convert from 'int' to 'uniform float'
ERROR: 0:29: '>' : wrong operand types no operation '>' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:30: '-' : wrong operand types no operation '-' exists that takes a left-hand operand of type 'uniform float' and a right operand of type 'const int' (or there is no acceptable conversion)
ERROR: 0:30: '[]' : integer expression required
ERROR: 0:32: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:34: 'constructor' : constructing matrix from matrix (reserved)
ERROR: 0:34: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:40: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:41: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:42: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 0:43: 'assign' : l-value required "gl_LightSource" (can't modify a uniform)
ERROR: 26 compilation errors. No code generated.


Resizing window (640 480)
LazerBlade

When your mind is racing, make sure it's not racing in a circle.

3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
lazerblade
 
Posts: 194
Joined: Thu Mar 18, 2010 3:31 am

Postby vinjn » Mon Nov 29, 2010 5:28 am

Super good!Thanks a lot.
Being curios for a hardware skinned shader for a long long time.
User avatar
vinjn
 
Posts: 27
Joined: Tue May 20, 2008 4:45 am

Postby christianclavet » Mon Nov 29, 2010 5:13 pm

Hi Lazerblade!

I think the OpenGL shader crashed. I've been testing this only on Windows Vista so far.

GLSL shader failed to compile


The shader is mostly unmodified from BlindSide and should work on any platform that support OpenGL & DirectX

Found out what causing this (most probable cause)
Checked your output:
GLSL version: 1.1


Not sure the shader can work on this release of GLSL. Mine report release 4.0 here. Do you have all the updated drivers for your X300? Look like it's running on the barebones opengl windows driver.

Humm the shader for openGL seem to require OpenGL 4.0! I've tried to run it on a openGL 3.3 (Radeon EAH 4350) on XP and it crashed too.

Is there someone that know more about shader that could rewrite the shader for a lesser version of OpenGL?

Since you are on XP, have tried the DX shaders? The DX shaders seem to work well on XP. (Tried with Radeons 4300 and 4600)
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Postby lazerblade » Mon Nov 29, 2010 6:46 pm

The DX shader works great.
I think I have the latest drivers, I do have an older card though.

Thx! :)
LazerBlade

When your mind is racing, make sure it's not racing in a circle.

3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
lazerblade
 
Posts: 194
Joined: Thu Mar 18, 2010 3:31 am

Postby macron12388 » Sun Dec 05, 2010 6:45 pm

Hi! :) good job! However I have to agree that the lighting could use some optimization:

OpenGL with HWS with Lighting: 17 FPS

OpenGL with HWS without Lighting: 340 FPS

:lol:
macron12388
 
Posts: 126
Joined: Wed Sep 29, 2010 8:23 pm

Postby devsh » Sun Dec 05, 2010 7:33 pm

we need this done quickly into irrlicht core :)
We chose to stream mesh data from Multiple OpenGL Contexts in many threads and do the other things, not because they are easy, but because they are hard! - JFK
User avatar
devsh
Competition winner
 
Posts: 1769
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Hardware Skinning for Irrlicht 1.7

Postby ritti » Fri Feb 22, 2013 4:16 pm

Hiho everybody,
I just wantet to ask if there are some updates or news about Hardwareskinning in Irrlicht.
I tried the code posted by christianclavet and it works on an ATI card (with some modifications in the glsl file because of the #define variables) but now I tried it on my Nvidia GT640 with no success.
The Models just dont appear if I enable HWSkinning.
And there aren't any compile errors.
Here is a part of the Terminal output:
cpp Code: Select all
getting name: : end
CXFileReader: reading animation
CXFileReader: reading animation key
CXFileReader: reading animation key
getting name: : hit
Time to load ascii X file: 93ms
Loaded mesh: dwarf.x
Joint Num: 46, current limit is 55 joints.
 


My System:
Ubuntu 12.10 x64
nvidia gt640
driver: Nvidia 304.48
OpenGL 4.2

What can I do to solve this problem?

Best regards

Ritti
ritti
 
Posts: 90
Joined: Tue Apr 10, 2012 12:09 pm

Re: Hardware Skinning for Irrlicht 1.7

Postby etreum79 » Tue Mar 05, 2013 9:30 pm

hi, I add the HardwareSkinCallback.ccp and HardwareSkinCallback.h in my project, and then I use my Dondo function as follows:

DLL_EXPORT void* DLL_APIENTRY HardwareSkin(const char* FileName)
{
IAnimatedMeshSceneNode* mesh1 = SceneManager->addAnimatedMeshSceneNode(SceneManager->getMesh(FileName));
ISkinnedMesh* mesh = (ISkinnedMesh*)mesh1->getMesh();
mesh->setHardwareSkinning(true);
HWSkinCB::getInstance()->setupNode(device,mesh1,17);
return (void *)mesh;
}

I fail to see the 3d model, this maybe bad my code? I copy the main example.

greetings.
etreum79
 
Posts: 42
Joined: Sun Feb 24, 2013 3:56 pm

Re: Hardware Skinning for Irrlicht 1.7

Postby etreum79 » Wed Mar 06, 2013 10:26 pm

ok, ok, this is for anyone that the same thing happens to me or Ritti, the shader opengl does not work only works in DX9.

A greeting.
etreum79
 
Posts: 42
Joined: Sun Feb 24, 2013 3:56 pm

Re: Hardware Skinning for Irrlicht 1.7

Postby Nadro » Thu Mar 07, 2013 11:31 am

For hardware skinning the best idea is to use shader-pipeline branch (OGL 2D rendering in broken, but it'll be fixed soon). With FVF support you can prepare custom vertex attributes.
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Hardware Skinning for Irrlicht 1.7

Postby etreum79 » Thu Mar 07, 2013 12:04 pm

Hi Nandro, although I know that here should not be the issue, but since you mention your shader-pipeline branch, I have several questions,

The version of that branch will irrlicht 2.0 support DirectX 11?

and if so approximate date for publication as a download? :roll:

otherwise it would be nice to explicaras how the skin with that branch hardware. :)

Greetings.
etreum79
 
Posts: 42
Joined: Sun Feb 24, 2013 3:56 pm

Re: Hardware Skinning for Irrlicht 1.7

Postby Nadro » Thu Mar 07, 2013 3:02 pm

Yes, this branch will be part of Irrlicht v2.0 (in v2.0 we'll oficially most of support current drivers + OGL ES drivers from ogl-es branch (those drivers will be available in v1.9) and 2 new drivers - DX11 and OGL3.x Core Profile).

Currently we don't know when v2.0 will be available. Check changes in shader-pipeline branch.

I don't have any samples on hdd, but you can check how to FVF system works in Irrlicht sources/examples (I also explained it on this forum in FVF topic some time ago). You can put vertex data like an indices and weights via attributes (GLSL) and semetics (HLSL).

BTW. I already fixed 2D renderer in OGL. All examples works fine now.
Nadro
 
Posts: 1647
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Hardware Skinning for Irrlicht 1.7

Postby etreum79 » Thu Mar 07, 2013 3:07 pm

Nadro thank you very much, I'm very close to both the trunk (which is now in its 1.9), both the branch-shader pipeline, I'll be waiting for the big news of its release
etreum79
 
Posts: 42
Joined: Sun Feb 24, 2013 3:56 pm

PreviousNext

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 1 guest