Skip to content

Commit 180cc60

Browse files
techiepriyanshAviii06r41k0uIshan-002
authored
add graphics tutorial (#558)
* add graphics tutorial * add sample gif images for decal and fire shader * Make instructions more accessible * Improve reliability * minor changes * Change dot product format * minor fixes * change fire shader to use diffuse texture instead of custom texture by default * HUD using UIComponent * Typo Fix * Add UIComponentDoc to toctree * Image Fix * Section Fix and gif * Effekseer guide * Add ParticleEffectComponent_Doc to toctree * Image fix and typos * Section Fix * Add file path to sponza * add spaces to images * add graphics tutorial * add spaces Co-authored-by: Archit <[email protected]> Co-authored-by: Pragyansh Chaturvedi <[email protected]> Co-authored-by: aviii06 <[email protected]> Co-authored-by: Ishan Rawat <[email protected]>
1 parent 03077b9 commit 180cc60

38 files changed

+323
-0
lines changed

docs/guides/getting_started.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Any user coming from ECS based game engines should be able to pick up the interf
1616
running_the_editor
1717
editor_layout
1818
using_TransformAnimationComponent
19+
graphics_tutorial
1920
making_HUD_using_ui-component
2021
effects_using_ParticleEffectComponent
2122
getting_help

docs/guides/graphics_tutorial.rst

Lines changed: 321 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
=============================================
2+
Exploring the Graphical capabilities of Rootex
3+
=============================================
4+
5+
This documentation aims to showcase the graphical capabilities of rootex and act as a tutorial for beginners to get started.
6+
7+
Let's start by creating a scene.
8+
9+
Create a scene
10+
--------------
11+
12+
To Create a Scene
13+
14+
1) Go to `file->CreateScene`.
15+
16+
2) Name the scene and click create.
17+
18+
.. figure:: images/graphics_tutorial/create_scene.png
19+
:alt: Create Scene
20+
:align: center
21+
22+
|
23+
24+
Now we Create an Empty Scene. An empty scene is nothing but objects. You can have different components in it, more on that later.
25+
26+
Create Empty scene
27+
------------------
28+
29+
To create an empty scene.
30+
31+
1) Right-click the root scene.
32+
2) Click Add Empty Scene
33+
34+
.. figure:: images/graphics_tutorial/add_empty_scene.png
35+
:alt: Create Empty Scene
36+
:align: center
37+
38+
|
39+
40+
.. figure:: images/graphics_tutorial/empty_scene_created.png
41+
:alt: Empty Scene Created
42+
:align: center
43+
44+
|
45+
46+
Giving Components
47+
-----------------
48+
49+
Now we give components to the empty scene.
50+
51+
1) Right-click the empty scene.
52+
2) Click Edit Components.
53+
3) Check the appropriate components, in this case, transform and Model. **Note**: Transform Component is a must.
54+
55+
.. figure:: images/graphics_tutorial/add_model_component_and_transform_component.png
56+
:alt: Components Added
57+
:align: center
58+
59+
|
60+
61+
4) Open inspector.
62+
5) Go to the model component in the inspector.
63+
6) Click the folder icon next to Model.
64+
7) Select the sponza 3D model file located at ``Rootex\game\assets\sponza\sponza.obj``
65+
66+
.. figure:: images/graphics_tutorial/select_model_file.png
67+
:alt: Selecting File
68+
:align: center
69+
70+
|
71+
72+
73+
For sponza initially, it would look like this:
74+
75+
.. figure:: images/graphics_tutorial/model_file_just_added.png
76+
:alt: Model File Just Added
77+
:align: center
78+
79+
|
80+
81+
This is due to the default settings of the sponza obj file. To get a better view, set the scale to (0.031, 0.031, 0.031) and set the LOD distance to 123:
82+
83+
.. figure:: images/graphics_tutorial/change_model_scale.png
84+
:alt: Change Model Scale and LOD Distance
85+
:align: center
86+
87+
|
88+
89+
We need to create an empty scene and add a light component to it to add light.
90+
91+
92+
Light Component
93+
---------------
94+
95+
To add light, we now create an empty scene.
96+
97+
1) Name the scene.
98+
2) Add transform and directional light components.
99+
100+
.. figure:: images/graphics_tutorial/add_sun_scene.png
101+
:alt: Directional Light Added
102+
:align: center
103+
104+
|
105+
106+
.. figure:: images/graphics_tutorial/edit_sun_components.png
107+
:alt: Added Components
108+
:align: center
109+
110+
|
111+
112+
To move freely, we can change our camera mode to Editor Camera. This allows us to move freely.
113+
114+
115+
Editor Camera
116+
-------------
117+
118+
To have complete control of movement, you can use an editor camera.
119+
120+
1) Click the figure icon at the top left of the viewport.
121+
2) Open dropdown of camera.
122+
3) Select editor camera.
123+
124+
.. figure:: images/graphics_tutorial/change_to_editor_camera.png
125+
:alt: Change To Editor Camera
126+
:align: center
127+
128+
|
129+
130+
To move, you have to hold the right mouse button and then use WASD space and shift keys to move. The cursor for direction. Space to move up and shift to move down.
131+
132+
.. figure:: images/graphics_tutorial/navigate_with_editor_camera.png
133+
:alt: Navigate With Editor Camera
134+
:align: center
135+
136+
137+
Point Light
138+
-----------
139+
140+
A point light is helpful if you have a source of light, e.g. a candle, bulb etc. To add a point light, follow the given steps.
141+
142+
1) Add an empty scene and give it a point light component.
143+
2) You can tweak its transformation value by either inputting it or dragging it left or right.
144+
145+
.. figure:: images/graphics_tutorial/add_point_light_texture.png
146+
:alt: Add Point Light
147+
:align: center
148+
149+
|
150+
151+
If you press 'q', a transform gizmo will appear on the object you have selected. You can adjust light location through it.
152+
For rotation and scaling gizmo, press 'w' and 'e', respectively.
153+
154+
.. figure:: images/graphics_tutorial/translate_point_light.png
155+
:alt: Translate Point Light 1
156+
:align: center
157+
158+
|
159+
160+
.. figure:: images/graphics_tutorial/translate_point_light_2.png
161+
:alt: Translate Point Light 2
162+
:align: center
163+
164+
|
165+
166+
.. figure:: images/graphics_tutorial/translate_point_light_3.png
167+
:alt: Translate Point Light 3
168+
:align: center
169+
170+
|
171+
172+
Overriding a material
173+
---------------------
174+
175+
To change the properties of one object without changing the original material, we can use overriding materials. To override a material:
176+
177+
1) Create a new basic material by going to file -> Create Resource.
178+
2) Name the material and click create.
179+
180+
.. figure:: images/graphics_tutorial/create_basic_material.png
181+
:alt: Create Basic Material
182+
:align: center
183+
184+
|
185+
186+
3) Go to the ``Inspector-> Model Component->Materials``.
187+
4) Click on the folder icon on the corresponding overriding material.
188+
5) Select the newly created basic material located at ``Rootex\game\assets\materials\new_cloth.basic.rmat``
189+
190+
.. figure:: images/graphics_tutorial/select_the_newly_created_basic_material.png
191+
:alt: Select Basic Material
192+
:align: center
193+
194+
|
195+
196+
Now you can change its basic textures by
197+
1)clicking on the pencil icon
198+
2)In the file viewer now click on the diffuse texture and select the appropriate diffuse texture.
199+
200+
|
201+
202+
.. figure:: images/graphics_tutorial/change_basic_material_texture.png
203+
:alt: Change Basic Material Texture
204+
:align: center
205+
206+
Custom Material
207+
---------------
208+
209+
210+
211+
1) Go to create Resource -> Custom Material.
212+
213+
.. figure:: images/graphics_tutorial/create_custom_material.png
214+
:alt: Create Custom Material
215+
:align: center
216+
217+
|
218+
219+
2) Enter material name.
220+
3) Now go to Inspector -> ModelComponent and then to Materials.
221+
4) Click on the folder icon and choose the material.
222+
223+
.. figure:: images/graphics_tutorial/select_the_newly_created_custom_material.png
224+
:alt: Select Custom Material
225+
:align: center
226+
227+
|
228+
229+
230+
Adding a shader
231+
---------------
232+
233+
To Add shader:
234+
235+
1) Click on the pencil icon on the overriding custom material.
236+
2) Now, in the file viewer you'll get options to add vertex and pixel shaders.
237+
3) Click on the pixel shader. A dialog box will open now you can just select the shader.
238+
239+
.. figure:: images/graphics_tutorial/change_custom_material_pixel_shader.png
240+
:alt: Change Custom Material Pixel Shader
241+
:align: center
242+
243+
|
244+
245+
You can use fire_pixel_shader from rootex/core/renderer/shaders
246+
247+
Clicking on the pencil icon opens an editor to customise the shader.
248+
249+
.. note::
250+
You can only add shaders to custom materials. If you want to use default material, override the original default material with custom material and then add a shader to the overriding material. The overriding material does inherit the textures of the original materials.
251+
252+
.. figure:: images/graphics_tutorial/changed_the_custom_material_pixel_shader_to_fire_shader.png
253+
:alt: Change Shader To Fire Shader
254+
:align: center
255+
256+
|
257+
258+
.. figure:: images/graphics_tutorial/edit_the_default_fire_pixel_shader_2.png
259+
:alt: Edit Fire Pixel Shader
260+
:align: center
261+
262+
|
263+
264+
.. figure:: images/graphics_tutorial/edited_the_default_fire_pixel_shader.png
265+
:alt: Final Fire Pixel Shader
266+
:align: center
267+
268+
|
269+
270+
.. figure:: images/graphics_tutorial/fire_shader_sample.gif
271+
:alt: Fire Shader Sample
272+
:align: center
273+
274+
275+
Decal Component
276+
---------------
277+
278+
To add a decal component.
279+
280+
1) Make a scene DECAL and give it transform and Decal Component.
281+
282+
.. figure:: images/graphics_tutorial/add_decal_component.png
283+
:alt: Add Decal Component
284+
:align: center
285+
286+
|
287+
288+
2) Create a decal material. By going to File -> CreateResource. And then slect Decal material in resource type dropdown.
289+
290+
.. figure:: images/graphics_tutorial/create_decal_material.png
291+
:alt: Create Decal Material
292+
:align: center
293+
294+
|
295+
296+
3) Now go to the inspector and click DecalComponent.
297+
4) Click on the folder icon and select the decal material.
298+
299+
.. figure:: images/graphics_tutorial/select_the_newly_created_decal_material.png
300+
:alt: Select Decal Material
301+
:align: center
302+
303+
|
304+
305+
5) Click on the pencil icon and the in the file viewer click on Decal Texture.
306+
307+
.. figure:: images/graphics_tutorial/change_decal_material_texture.png
308+
:alt: Change Decal Material
309+
:align: center
310+
311+
|
312+
313+
6) Shift its position by manipulating the transform component.
314+
315+
By default, the decal shader projects on the negative z-axis. You can rotate it till you get the desired result.
316+
317+
.. figure:: images/graphics_tutorial/decal_sample.gif
318+
:alt: Decal Sample
319+
:align: center
320+
321+
|
1.49 MB
Loading
1.15 MB
Loading
929 KB
Loading
1.49 MB
Loading
464 KB
Loading
1.47 MB
Loading
2.02 MB
Loading
1.34 MB
Loading

0 commit comments

Comments
 (0)