Horde3D

Next-Generation Graphics Engine
It is currently 15.12.2018, 14:31

All times are UTC + 1 hour




Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: 21.06.2011, 13:53 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
2 imran:
Volker attached a patch that you should use with your SVN client. It will modify the material of the man model, that comes with Horde3D, and adds a new shader that supports colors.

Anyway, I dragged the shader out of the patch. Here it is.
Place the shader in your <Project Directory Name>\shaders.
In your material you should add the line
Code:
<Uniform name="materialCol" a="1.0" b="0.0" c="1.0" d="1.0" />

These values are the color of the displayed model. You should modify them to get the color you want.

So, your material should look like:
Code:
<Material>
  <Shader source="MatColor.shader" />
  <Uniform name="materialCol" a="1.0" b="0.0" c="1.0" d="1.0" />
</Material>

[Offtop]
For some reason I couldn't attach the file directly, the forum says "The extension shader is not allowed". I tried to change filename to "MatColor.shader._", but it won't upload either.


Hi Irdis
Thanks for the help , I think this was the best that I expected, but it has still got a problem and it is that, it asks for some kind of un expected token at line number 205.
Following is the error which I get on loading

Code:
Shader resource 'MatColor.shader' in line 205: Error: Unexpected token found


In line number 205 in MatCol.shader I don't have any idea which token does it expect

Rehgards Imran Habib


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 15:32 
Offline

Joined: 17.11.2009, 17:00
Posts: 168
Location: Russia, Moscow
Currently I don't have a working copy of horde editor, so I can only guess. Judging from the code, line 205 is working with alpha test.
If you don't need the alpha test functionality right now, you may try to delete the code that is needed for alpha test. So, delete in all [FS_...] shaders code that begins with #ifdef _F05_AlphaTest and ends with #endif.
I'm not a specialist in shaders, so this is just a temprorary solution. If you get more errors, well, you should wait for Volker. Maybe I got something broken when dragged the shader out of the patch (I did it manually as I don't have SVN client on this machine) :oops: .


Last edited by Irdis on 21.06.2011, 15:41, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 15:40 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
Currently I don't have a working copy of horde editor, so I may only guess. Judging from the code, line 205 is working with alpha test.
If you don't need the alpha test functionality right now, you may try to delete the code that is needed for alpha test. So, delete in all [FS_...] shaders code that begins with #ifdef _F05_AlphaTest and ends with #endif.
I'm not a specialist in shaders, so this is just a temprorary solution.


i will try that also but tell me one important thing and that is , i am using horde 3d editor beta 2 so should i use "materialCol.shader.xml" that was reffered to me earlier

because may be that works with beta 2 , when i use "materialCol.shader.xml" this I don't get an error but stil i can't see the model , and only can see it in debug mode

may be changing the values of a , b c, d wil help which you reffered to follow as follows

<Material>
<Shader source="MatColor.shader" />
<Uniform name="materialCol" a="1.0" b="0.0" c="1.0" d="1.0" />
//as i have a texture so i have this also
<Sampler name="albedoMap" map="texturemap.png" />

</Material>


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 15:45 
Offline

Joined: 17.11.2009, 17:00
Posts: 168
Location: Russia, Moscow
imranhabib wrote:
Irdis wrote:
Currently I don't have a working copy of horde editor, so I may only guess. Judging from the code, line 205 is working with alpha test.
If you don't need the alpha test functionality right now, you may try to delete the code that is needed for alpha test. So, delete in all [FS_...] shaders code that begins with #ifdef _F05_AlphaTest and ends with #endif.
I'm not a specialist in shaders, so this is just a temprorary solution.


i will try that also but tell me one important thing and that is , i am using horde 3d editor beta 2 so should i use "materialCol.shader.xml" that was reffered to me earlier

because may be that works with beta 2 , when i use "materialCol.shader.xml" this I don't get an error but stil i can't see the model , and only can see it in debug mode

may be changing the values of a , b c, d wil help which you reffered to follow as follows

<Material>
<Shader source="MatColor.shader" />
<Uniform name="materialCol" a="1.0" b="0.0" c="1.0" d="1.0" />
//as i have a texture so i have this also
<Sampler name="albedoMap" map="texturemap.png" />

</Material>


This shader was written for beta 4-5, so it won't work with editor beta 2. I strongly suggest you to update to the latest editor through SVN. But the drawback is that you will have to compile it, and in order to compile it you need qt 4.


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 15:50 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
imranhabib wrote:
Irdis wrote:
Currently I don't have a working copy of horde editor, so I may only guess. Judging from the code, line 205 is working with alpha test.
If you don't need the alpha test functionality right now, you may try to delete the code that is needed for alpha test. So, delete in all [FS_...] shaders code that begins with #ifdef _F05_AlphaTest and ends with #endif.
I'm not a specialist in shaders, so this is just a temprorary solution.


i will try that also but tell me one important thing and that is , i am using horde 3d editor beta 2 so should i use "materialCol.shader.xml" that was reffered to me earlier

because may be that works with beta 2 , when i use "materialCol.shader.xml" this I don't get an error but stil i can't see the model , and only can see it in debug mode

may be changing the values of a , b c, d wil help which you reffered to follow as follows

<Material>
<Shader source="MatColor.shader" />
<Uniform name="materialCol" a="1.0" b="0.0" c="1.0" d="1.0" />
//as i have a texture so i have this also
<Sampler name="albedoMap" map="texturemap.png" />

</Material>


This shader was written for beta 4-5, so it won't work with editor beta 2. I strongly suggest you to update to the latest editor through SVN. But the drawback is that you will have to compile it, and in order to compile it you need qt 4.


but i am using the horde3d editor .exe available and not the SVN repository where can i get beta 5 other then SVN and I came accross qt4 and I think I using qt4 also consumes alot of time

So is there any way i can get beta 5 version of horde3d editor


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 16:02 
Offline

Joined: 17.11.2009, 17:00
Posts: 168
Location: Russia, Moscow
Currently, there are no other places from where you can download the latest version (only in source). The latest binary's are for beta 2. If you wish, I can compile the editor for beta 5 tomorrow.
Or, if you wish to stay on beta 2 (although beta 5 is about 2-3 times faster than beta 2), as Volker suggested, you should take model.shader.xml, copy and rename it to MaterialColor.shader.xml, add uniform materialCol in all fragment (FS) shaders and manually all references to "albedoMap" like vec4 albedo = albedoMap to vec4 albedo = materialCol.


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 16:45 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1149
Location: Germany
You will run into trouble if you're using Beta5 of Horde with the editor binary for Beta2. If you are using the Beta2 you should be able to use the MaterialCol.shader.xml referenced in the wiki if you're using Beta5 you can't use the editor (at least not until you compile it yourself, or someone else build new packages).

I didn't updated the binary packages myself, because there are several places where the editor is not stable or lacks features, that were present before but are currently not running with the latest Horde version. Until I get a job where I can work for the editor again, I currently won't have the time to support it well enough to release binary packages (but as Irdis mentioned, maybe he will provide you some precompiled binaries).


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 16:47 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
Currently, there are no other places from where you can download the latest version (only in source). The latest binary's are for beta 2. If you wish, I can compile the editor for beta 5 tomorrow.
Or, if you wish to stay on beta 2 (although beta 5 is about 2-3 times faster than beta 2), as Volker suggested, you should take model.shader.xml, copy and rename it to MaterialColor.shader.xml, add uniform materialCol in all fragment (FS) shaders and manually all references to "albedoMap" like vec4 albedo = albedoMap to vec4 albedo = materialCol.



I didnt understand that day Volker and here you explained better i think so i took the default model.shader file and copied it as an xml
and after modifying it, it looks like as attached file ,

and my material file has following code
Code:
<Material>
   <Shader source="materialCol.shader.xml" />
   <Sampler name="albedoMap" map="texturemap3.jpg" />
</Material>


But still i can't see object but debug mode it is available
I have attached the file after modifying the way you told me to modify it , kindly check if i am doing it right I changed the file as directed by you


Attachments:
materialCol.shader.xml [9.41 KiB]
Downloaded 274 times
Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 16:54 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1149
Location: Germany
Maybe you should try to understand first, why it won't make much sense to rename the sampler in the shader and not in the material.
Then you might have a deep look at the changes I provided with the patch. And then you might realize that renaming some variables is NOT the solution for your material color problem, but using a uniform for the gl_FragColor.rgb instead of a texture lookup.

Don't get me wrong, but if you don't understand what I'm talking about, it might be better you're changing the topic of your master thesis.


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 17:25 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Volker wrote:
Maybe you should try to understand first, why it won't make much sense to rename the sampler in the shader and not in the material.
Then you might have a deep look at the changes I provided with the patch. And then you might realize that renaming some variables is NOT the solution for your material color problem, but using a uniform for the gl_FragColor.rgb instead of a texture lookup.

Don't get me wrong, but if you don't understand what I'm talking about, it might be better you're changing the topic of your master thesis.


There is a difference between your way of answering a question and Irdis way of answering a question, If you are a professor then don't think that your student should have
the same mind as you , you have spend years to reach to this level and i need to spend years to reach to the mind that you have , I think its always good to teach or answer
a question considering in mind the level of student one has, Í told you i am not a PHD doctorate student , i have not developed your game engine ,

Tell me 1 thing why did i understand IRdis and i didnt the same thing said by you ? the answer is only 1 and it is that Irdis answered me considering as i don't know anything
but you answered me considering as I am developer of this game . things you explain are not complex , but the way you explain these are made complex , i can't see what is inside your mind
where you are refering what

i just have a simple question and I have been reffered to modify things that are done by you now how can i know that what you developed is working which way ?

Don't get me wrong but kindly reply in a better and simpler way , "you said using gl_FragColor.rgb instead of texture lookup, I change it


Code:
<Sampler name="albedoMap" map="texturemap3.jpg" />
to
<Sampler name="albedoMap" map="gl_FragColor.rgb " />


but are you sure that get the model.shader and copy it in .xml and rename it to materialCol.shader.xml was not the solution given by you .?

You have mixed evrything now , so kindly explain from begining in a simpler way as you should explain a student , what file to use how, else

Leave if you can't , Irdis will answer my post .

Thank You So much


Regards Imran Habib


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 17:49 
Offline

Joined: 17.11.2009, 17:00
Posts: 168
Location: Russia, Moscow
2 imran:
You seem to be confused about terminology, because you modify only the material, and not the shader.
You can think of a material as a sort of configuration file - you only specify values to some parameters. The shader, on the other hand, is like an algorithm, which specifies how the program should work. Volker and me were talking about modifying the shader, that specifies how the model will be processed by the videocard, and not the material, that specifies the parameters of the processed model.

I took a look at the material color shader that you downloaded first from here.
Did you try a material file like this?
Code:
<Material>
<Shader source="materialCol.shader.xml" />
<Uniform name="Materialcol" a="1.0" b="0.0" c="1.0" d="1.0" />
</Material>


The material syntax is for beta 5, so the material may not work out of the box. You should see other materials for models that come with the editor.


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 18:42 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
2 imran:
You seem to be confused about terminology, because you modify only the material, and not the shader.
You can think of a material as a sort of configuration file - you only specify values to some parameters. The shader, on the other hand, is like an algorithm, which specifies how the program should work. Volker and me were talking about modifying the shader, that specifies how the model will be processed by the videocard, and not the material, that specifies the parameters of the processed model.

I took a look at the material color shader that you downloaded first from here.
Did you try a material file like this?
Code:
<Material>
<Shader source="materialCol.shader.xml" />
<Uniform name="Materialcol" a="1.0" b="0.0" c="1.0" d="1.0" />
</Material>


The material syntax is for beta 5, so the material may not work out of the box. You should see other materials for models that come with the editor.


First of all Thank You so much for such a nice way of describing the answer , !

I actually attached in my previous post the shader file that I modified which I was asked to rename as MaterialCol.shader.xml (correct me if i am wrong)

and I modified this file evry where from ""vec4 albedo = albedoMap to vec4 albedo = materialCol"""
in that shader file, You can find attached file in my previous post and see how did I modify it, and if i am not wrong you are saying that it will not work with
beta 2 version of horde3d editor and

Quote:
Did you try a material file like this?
Code:
<Material>
<Shader source="materialCol.shader.xml" />
<Uniform name="Materialcol" a="1.0" b="0.0" c="1.0" d="1.0" />
</Material>



yes I tried like that also but still didn't get any success :(

Quote:
The material syntax is for beta 5, so the material may not work out of the box. You should see other materials for models that come with the editor.

What I understand from it is as I must find another shader file right ? which should work with beta 2 ..

If yes where can i find that file..


One Last thing , May be ! i must also consider the difference between color and texture file object

what will i have to do if i have simple texture applied over an object from 3d max , but to be concise that texture is nothing else but only a color but in jpg form.

Thank You so much once again , for being so clear...


Top
 Profile  
Reply with quote  
PostPosted: 21.06.2011, 19:06 
Offline

Joined: 17.11.2009, 17:00
Posts: 168
Location: Russia, Moscow
Forget for a moment about modifying the shader. Redownload the shader that was in my previous post, place it into <Project Directory>\shaders. Try the material that was in my last post, it was configured for this shader. The material should be either in <Project Directory>\materials, or in <Project Directory>\<Model Name>.

Are there any errors in the log?

About using colors as a small texture: you should just reexport the model to collada and import it again to horde using beta 2 collada converter. You can find it in the beta 2 package on the sourceforge. Link.
Then manually copy all the exported directories to your <Project Directory> and try to open the model in the editor. This way you don't have to modify shaders or materials.


Top
 Profile  
Reply with quote  
PostPosted: 22.06.2011, 15:36 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
Forget for a moment about modifying the shader. Redownload the shader that was in my previous post, place it into <Project Directory>\shaders. Try the material that was in my last post, it was configured for this shader. The material should be either in <Project Directory>\materials, or in <Project Directory>\<Model Name>.

Are there any errors in the log?

About using colors as a small texture: you should just reexport the model to collada and import it again to horde using beta 2 collada converter. You can find it in the beta 2 package on the sourceforge. Link.
Then manually copy all the exported directories to your <Project Directory> and try to open the model in the editor. This way you don't have to modify shaders or materials.


2 Irdis
Sooooooper Cool! Thanks alots....
It works IT Works Woww , m really happy to get a wonderful answer and felt so convieinient to post my question to you.
I am really glad there are people on this forum who guide in a better way.

your last post really helped alot and it solved the problem .. Now i can get these objects from 3d max and can see them in horde3d editor,
I even can see the multi colored objects , but for that I have to change the values of a , b, c , d in material ..

Code:
<Uniform name="Materialcol" a="2.0" b="2.0" c="3.0" d="1.0" />


Lastly For Textures i have a .material file which also asks me the same thing as previous, i mean tries to find shaders/model.shader.
I think there must be something for textures also , because when i apply skining_metal.shader.xml it works but I don't know for
my personal texture applied what file i have to include instead of model.shader. I guess just like MaterialCol.shader.xml, it is supposed
to be another file which works for textures as well.
M i right ?

Thank You once again


Top
 Profile  
Reply with quote  
PostPosted: 22.06.2011, 18:51 
Offline

Joined: 17.11.2009, 17:00
Posts: 168
Location: Russia, Moscow
If I correctly understand you, you want to have a model with both texture (for example, front of the wall) and the modifyable color (back of the wall), right? Well, the material color shader was designed to work only with color of the model, so it is either texture (with another shader, like model.shader.xml), or color (with material color shader).

If you stick with beta 2, you should use only shaders with extension *.shader.xml, and not *.shader. If you have materials that refer to model.shader, change them to model.shader.xml or skinning_metal.shader.xml.
By the way, I compiled the editor for beta 5, if you wish, you can use the latest version of the engine and editor. You can use the material color shader that I posted earlier.

You can also change color of the model in the editor (in material editor you can modify values a,b,c,d that correspond to your color).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group