Shader examples: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
[[Image:RoadShineScreen.jpg|200px|thumb|left|Road shine]]
[[Image:RoadShineScreen.jpg|200px|thumb|left|Road shine]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_roadshine.zip Download shader_roadshine.zip] &nbsp; ''Requires Shader Model 2 graphics card''
[http://nightly.mtasa.com/files/shaders/shader_roadshine.zip Download shader_roadshine.zip] &nbsp; ''Requires Shader Model 2 graphics card''
<br><br>
<br><br>
This resource creates a light reflection effect on the ground (looks best when moving).  
This resource creates a light reflection effect on the ground (looks best when moving).  
Line 20: Line 20:
[[Image:RoadShine2Screen.jpg|200px|thumb|left|Road shine 2]]
[[Image:RoadShine2Screen.jpg|200px|thumb|left|Road shine 2]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_roadshine2.zip Download shader_roadshine2.zip] &nbsp; ''Requires Shader Model 2 graphics card''
[http://nightly.mtasa.com/files/shaders/shader_roadshine2.zip Download shader_roadshine2.zip] &nbsp; ''Requires Shader Model 2 graphics card''
<br><br>
<br><br>
Bit more complicated than the first Road shine, as it tracks the sun or moon to calculate the position of the highlight.
Bit more complicated than the first Road shine, as it tracks the sun or moon to calculate the position of the highlight.
Line 31: Line 31:
[[Image:UVScollScreen.jpg|200px|thumb|left|UV scroll]]
[[Image:UVScollScreen.jpg|200px|thumb|left|UV scroll]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_uv_scroll.zip Download shader_uv_scroll.zip]
[http://nightly.mtasa.com/files/shaders/shader_uv_scroll.zip Download shader_uv_scroll.zip]
<br><br>
<br><br>
This resource scrolls a texture from left to right. It doesn't use vertex or pixels shaders, so it should work on all hardware.
This resource scrolls a texture from left to right. It doesn't use vertex or pixels shaders, so it should work on all hardware.
Line 39: Line 39:
[[Image:UVScriptedScreen.jpg|200px|thumb|left|UV scripted]]
[[Image:UVScriptedScreen.jpg|200px|thumb|left|UV scripted]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_uv_scripted.zip Download shader_uv_scripted.zip]
[http://nightly.mtasa.com/files/shaders/shader_uv_scripted.zip Download shader_uv_scripted.zip]
<br><br>
<br><br>
This resource controls a texture's UVs using Lua. It shows that anything is possible if you can imagine it.
This resource controls a texture's UVs using Lua. It shows that anything is possible if you can imagine it.
Line 47: Line 47:
[[Image:PedMorphScreen.jpg|200px|thumb|left|Ped morph]]
[[Image:PedMorphScreen.jpg|200px|thumb|left|Ped morph]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_ped_morph.zip Download shader_ped_morph.zip] &nbsp; ''Requires Shader Model 2 graphics card''
[http://nightly.mtasa.com/files/shaders/shader_ped_morph.zip Download shader_ped_morph.zip] &nbsp; ''Requires Shader Model 2 graphics card''
<br><br>
<br><br>
This resource uses a vertex shader to modify the geometry of a ped model as it is rendered.
This resource uses a vertex shader to modify the geometry of a ped model as it is rendered.
Line 57: Line 57:
[[Image:PedShellScreen.jpg|200px|thumb|left|Ped shell]]
[[Image:PedShellScreen.jpg|200px|thumb|left|Ped shell]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_ped_shell.zip Download shader_ped_shell.zip] &nbsp; ''Requires Shader Model 2 graphics card''
[http://nightly.mtasa.com/files/shaders/shader_ped_shell.zip Download shader_ped_shell.zip] &nbsp; ''Requires Shader Model 2 graphics card''
<br><br>
<br><br>
This resource draws a translucent effect in a second render pass. The first pass is done by GTA, and the vertex shader is only applied in the second to add the effect 'on top' of the standard output.
This resource draws a translucent effect in a second render pass. The first pass is done by GTA, and the vertex shader is only applied in the second to add the effect 'on top' of the standard output.
Line 67: Line 67:
[[Image:CarPaintScreen.jpg|200px|thumb|left|Car paint]]
[[Image:CarPaintScreen.jpg|200px|thumb|left|Car paint]]
<table border=0><tr><td valign=top height=170>
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_car_paint.zip Download shader_car_paint.zip] &nbsp; ''Requires Shader Model 2 graphics card''
[http://nightly.mtasa.com/files/shaders/shader_car_paint.zip Download shader_car_paint.zip] &nbsp; ''Requires Shader Model 2 graphics card''
<br><br>
<br><br>
This resource shows you how to apply a shader to the vehicle models. The shader itself is not that great, so don't get your hopes up.
This resource shows you how to apply a shader to the vehicle models. The shader itself is not that great, so don't get your hopes up.
</td></tr></table>
==Water==
[[Image:WaterScreen.jpg|200px|thumb|left|Water]]
<table border=0><tr><td valign=top height=170>
[http://nightly.mtasa.com/files/shaders/shader_water.zip Download shader_water.zip] &nbsp; ''Requires Shader Model 2 graphics card''
<br><br>
This resource applies a shader to the GTA world water. The Lua script shows how to use a timer to transfer the conventional water color setting to the shader.
</td></tr></table>
</td></tr></table>

Revision as of 03:46, 7 July 2011

This page contains some example shader resources to try in 1.1. If you are looking to make your own, please be sure to read about the shader element as well.

Road shine

Road shine

Download shader_roadshine.zip   Requires Shader Model 2 graphics card

This resource creates a light reflection effect on the ground (looks best when moving). It uses a custom flag in the effect file to generate surface normals for the ground model:

int CUSTOMFLAGS
<
    string createNormals = "yes";
>;

Surface normals are not usually present in the ground and building models, but are useful for creating lighting effects such as these.

Road shine 2

Road shine 2

Download shader_roadshine2.zip   Requires Shader Model 2 graphics card

Bit more complicated than the first Road shine, as it tracks the sun or moon to calculate the position of the highlight. The effect can be hard to see depending on the time of day.

Best used with the play resource as the model it modifies is near the initial spawn point.

UV scroll

UV scroll

Download shader_uv_scroll.zip

This resource scrolls a texture from left to right. It doesn't use vertex or pixels shaders, so it should work on all hardware.

UV scripted

UV scripted

Download shader_uv_scripted.zip

This resource controls a texture's UVs using Lua. It shows that anything is possible if you can imagine it.

Ped morph

Ped morph

Download shader_ped_morph.zip   Requires Shader Model 2 graphics card

This resource uses a vertex shader to modify the geometry of a ped model as it is rendered.

When the resource has started, use the 'k' and 'l' keys to change morph size. If you change your player's skin, restart the resource to modify the new model.

Ped shell

Ped shell

Download shader_ped_shell.zip   Requires Shader Model 2 graphics card

This resource draws a translucent effect in a second render pass. The first pass is done by GTA, and the vertex shader is only applied in the second to add the effect 'on top' of the standard output.

When the resource has started, use the 'k' key to see the shell effect. If you change your player's skin, restart the resource to see the effect applied to the new model.

Car paint

Car paint

Download shader_car_paint.zip   Requires Shader Model 2 graphics card

This resource shows you how to apply a shader to the vehicle models. The shader itself is not that great, so don't get your hopes up.

Water

Water

Download shader_water.zip   Requires Shader Model 2 graphics card

This resource applies a shader to the GTA world water. The Lua script shows how to use a timer to transfer the conventional water color setting to the shader.