Difference between revisions of "Basic Pipeline Tutorial"
(New page: {| border="0" | {{ContentBlock|width=800|color=white |content={{!!}} == Overview == In this tutorial, I will try to show you how the Horde3D pipeline system works. At the first look, wh...) |
m (mispelled platform) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 4: | Line 4: | ||
== Overview == | == Overview == | ||
− | In this tutorial, I will try to show you how the Horde3D pipeline system works. At the first look, when you haven't really | + | In this tutorial, I will try to show you how the Horde3D pipeline system works. At the first look, when you haven't really worked with an advanced pipeline system before, it may look a little bit complicated, but I will show how user friendly it is and how this powerful tool is useful. |
'''Requirements:'''<BR/> | '''Requirements:'''<BR/> | ||
− | - The Horde3D SDK | + | - The Horde3D SDK 1.0.0 Beta2 |
== Creating the pipeline == | == Creating the pipeline == | ||
− | First of all, I will show you how to create a really basic pipeline with only one context. For this, we will use the chicago example in the Horde3D SDK to see how the pipeline and his context can affect a scene. If you use Visual Studio, open the "Horde3D.sln" file to get into the chicago sample, | + | First of all, I will show you how to create a really basic pipeline with only one context. For this, we will use the chicago example in the Horde3D SDK to see how the pipeline and his context can affect a scene. If you use Visual Studio, open the "Horde3D.sln" file to get into the chicago sample, otherwhise use your configuration to open the chicago example or edit each files in your favorite editor. In the "app.cpp" file, we will change the foward pipeline resource to take our custom pipeline instead of the forward pipeline, so in the Application::init() function change this line: |
{{CppSourceCode| | {{CppSourceCode| | ||
Line 22: | Line 22: | ||
<BR/> | <BR/> | ||
− | + | to this line: | |
{{CppSourceCode| | {{CppSourceCode| | ||
Line 56: | Line 56: | ||
<BR/> | <BR/> | ||
− | I have tried to make this pipeline as simple as possible. I will explain how it | + | I have tried to make this pipeline as simple as possible. I will explain how it works : |
{{CppSourceCode| | {{CppSourceCode| | ||
Line 66: | Line 66: | ||
</source>}} | </source>}} | ||
− | This tag means that | + | This tag means that its child tags are going to be related to pipeline tags. |
<BR/> | <BR/> | ||
Line 79: | Line 79: | ||
− | This tag means that | + | This tag means that its child tags are going to be related to direct rendering tags. |
<BR/> | <BR/> | ||
Line 91: | Line 91: | ||
</source>}} | </source>}} | ||
− | The stage is here to include a series of actions, and you can have multiple | + | The stage is here to include a series of actions, and you can have multiple stages if you want, even if in this example we have only one. It is useful since you can disable or enable a stage within an Horde3D function, and you can link it a material within the optional "link" attribute. If you want, you can look at the "globalSettings.material.xml" file to see what it contains, and if everyting is normal, you should see that a cube map is binded to the texture unit 7, this gonna be the ambient texture that will determine the ambient color of the scene. Finally, for each stages, don't forget to add an id, and in this example the id gonna be "FirstStage". |
<BR/> | <BR/> | ||
Line 113: | Line 113: | ||
</source>}} | </source>}} | ||
− | This tag is used to clear the | + | This tag is used to clear the content of the current target. The attribute "depthBuf" is used to determine if you want to clear the depth buffer of the target, and each "colBufX" is an attribute to clear the specified color buffer of the target. In this example, we use only one color buffer. |
<BR/> | <BR/> | ||
Line 129: | Line 129: | ||
<BR/> | <BR/> | ||
− | Now you have to compile the chicago example. Go in the "build" folder, and copy the new executable in the "win32" folder of the SDK. | + | Now you have to compile the chicago example. Go in the "build" folder, and copy the new executable in the "win32" folder of the SDK. If you execute this example you should see nothing. If you look at the engine log and there is no error, it means that everyhing have been rightly done. If you see a black screen, it's because there is no "AMBIENTCOLOR" in each shader linked to each geometry. You have to add this context to each used shaders. |
− | In the chicago sample, three shaders are used : one for the animated model one for the sky and one for the | + | In the chicago sample, three shaders are used : one for the animated model one for the sky and one for the platform. Open the "skinning.shader.xml" file since it's the shader used for the animated man. Next, you have to add this within the "shader" tag: |
{{CppSourceCode| | {{CppSourceCode| | ||
description= Shader| | description= Shader| | ||
Line 200: | Line 200: | ||
As you can see, the id of the context tag is "AMBIENTCOLOR", exactly like the context in our pipeline. It means that within this context this shader will be executed for the current geometry. Then, you have the "InsCode" tag. It is here to insert the "vertCommon.glsl" file wich contain some really useful functions for the vertex shader, like "calcWorldVec()" and "calcWorldPos()". Finally, I have tried to make the vertex and the pixel shader self-explained, so you can read them if you want to learn how basically the context for the shader is within Horde3D. | As you can see, the id of the context tag is "AMBIENTCOLOR", exactly like the context in our pipeline. It means that within this context this shader will be executed for the current geometry. Then, you have the "InsCode" tag. It is here to insert the "vertCommon.glsl" file wich contain some really useful functions for the vertex shader, like "calcWorldVec()" and "calcWorldPos()". Finally, I have tried to make the vertex and the pixel shader self-explained, so you can read them if you want to learn how basically the context for the shader is within Horde3D. | ||
− | Now you can execute the chicago sample and you should see each man moving, but they sould not have any animations because, in the shader, we don't use skinning. If you want to learn how skining work with Horde3D, look at the shader within the "AMBIENT" context of the file, and you should see the difference between both vertex shaders. For the other two | + | Now you can execute the chicago sample and you should see each man moving, but they sould not have any animations because, in the shader, we don't use skinning. If you want to learn how skining work with Horde3D, look at the shader within the "AMBIENT" context of the file, and you should see the difference between both vertex shaders. For the other two shaders, the one for the sly and the one for the platform, you can copy the "AMBIENT" context of each shaders file and name them "AMBIENTCOLOR" to see them in the scene. |
== Conclusion == | == Conclusion == | ||
− | Finally, I have tried to make this tutorial as simple as possible, with a basic pipeline, so that it | + | Finally, I have tried to make this tutorial as simple as possible, with a basic pipeline, so that it shouldn't be too hard for any programmers to learn how the pipeline system work. It's why there is no lighting or multiple buffers, but with the basics, you can learn more by yourself by looking at any of the others Horde3D SDK pipelines and by trying things by yourself! |
}} | }} |
Latest revision as of 23:01, 5 October 2010
|
|