3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1] 2 3 ... 7

Author Topic: Addon : SystemShaders1_shx  (Read 26599 times)

« on: August 08, 2010, 06:35:07 AM »
Addon : SystemShaders1_shx




History
1.09 - Added : alpha, mirrorUV and emissive factor
1.08 - Fixed transparency issues when envmap is greater than 1
1.07 - Added spcular map shaders and rimlight/reflect shaders, UVW animation on all shaders
1.06 - Changes to support SpotLights
1.05 - Added rgb2tx shaders.
1.04 - Fixed Vegetation shader not showing correct on multiple textures
1.03 - PointLight not illuminating lightmap when sun is black, fixed,
added 0015_user_bumpy_glossy_tile and 0025_user_vegetation
1.02
 - Pointlight not illuminating diffuse texture when sun is black, fixed,
 All shaders are compiled HLSL and are instant on selection.
1.01 - ViewVec not properly calculated, fixed.
1.00 - First release

Requirements:
-3DRad v6.49+/7.02b+ (plus skinmesh patch patch is for 6.49/7.02 only)
-GFX card needs to support shader model 2.0 or better (Geforce 5 or better)


Download here
http://www.3drad.com/addons/SystemShaders1_shx.php


Note about lighting methods
All bumped shaders use per pixel lighting
All non bumped use vertex lighting

Tip : To get per pixel lighting but you don't want it bumped, you can set the bump amplitude to 0 in the skinmesh dialog to achieve very smooth per pixel lighting


ALL SHADERS:
1. You can finetune RGB color to texture by a simple script using iShaderFloat3Set(OBJ_0,"cColor",floatR,floatG.floatB) and link to skinmesh.
2. You can repeat uvmap via "Bump texture Tiles" in the skinmesh dialog
3. You can mirror UV by a simple script using iShaderFloatSet(OBJ_0,"MirrorUV",1) and link to skinmesh. (1.09 only)
4. You can tune global alpha for all shaders by using iShaderFloatSet(OBJ_0,"cAlpha",float) and link to skinmesh. (1.09 only)
5. you can tune emissive factor for all shaders by using iShaderFloatSet(OBJ_0,"cEmissive",float) and link to skinmesh. (1.09 only)

You can also control the skinmesh dialog options by script
1. iShaderFloatSet(OBJ_X, "TileCount", float");
2. iShaderFloatSet(OBJ_X, "environmentMapBlend", float);

How to UVW animate any shader example :
Code: [Select]
float x,z=0.0f;
void Main()
{
  x+=0.001;  //speed in x dir
  z+=0.001;  //speed in z dir
  iShaderFloat2Set(OBJ_X, "UVW",x,z);
}


Glossy Shaders:
1. You can finetune glossiness by a simple script using iShaderFloatSet(OBJ_0,"cGloss",float) and link to skinmesh.

Bumpy shaders
1. You can set bump height via "Bump Amplitude" in the skinmesh dialog
2. Or by script :  iShaderFloatSet(OBJ_X, "bumpScale", float);

Basic Shaders

0014_user_bumpy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Same as 0003_pp_bumpy

Tiling and bump amplitude



0015_user_bumpy_glossy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Same as 0004_pp_bumpy_glossy

Andro tiled bumped and glossy


0016_user_tile  - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection
  Same as 0000_default

0017_user_glossy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection
  Same as 0002_pp_smooth_glossy

0020_user_cel  - WITH OUTLINE - Cel shader for cartoonish look - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection (reflection is also cel shaded)
  Special settings:
  1. you can set outline thickness via "Bump Amplitude" in the skinmesh dialog

Adjusting outline thickness


Cel shaded outlined and reflective


0022_user_wireframe  - Wireframe shader - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection.

0025_user_vegetation  - Supports all lightmodes (not backfaces) sunlight, 4 pointlights, fog, envmap reflection
This shader does not cull backsides and does alphatests to make textures inter-transparent.
- Works great on X-trees, trees, grass, bushes etc.

0046_user_rim_bumpy_glossy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Special settings:
  1. You can finetune fresnel for rim reflection or lightning by a simple script.
Code: [Select]
  iShaderFloatSet(OBJ_0," Fresnel_Start", float);
  iShaderFloatSet(OBJ_0," Fresnel_End", float);
  iShaderFloatSet(OBJ_0," Fresnel_Multiplier", float);
  iShaderFloat4Set(OBJ_0," Fresnel_Color", floatR,floatG,floatB,floatA);

0047_user_rim_bumpy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Special settings:
  Same as above.

0048_user_rim_glossy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Special settings:
  Same as above.

Car using rim reflection - Tip: Set reflection factor 2 in the skinmesh dialog.


0049_user_rim_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Special settings:
  Same as above.

Andro in rim light (backlight)




Texture Shaders

0030_user_lightmap_bumpy  - Supports all lightmodes sunlight, 4 pointlights, fog
  Required textures - must be placed in the skinmesh folder
  - 000_nm.<ext>      - Normalmap - (ext can be any supported image format .jpg .bmp .dds .png)
  - userTextureA.dds  - LightMap, this has to be a DXT1 dds texture, it will blend with the mesh texture, does not tile.

Tiled texture + streched Lightmap used here. (userTextureA.dds)


0031_user_lightmap_glossy  - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection
  Required textures - must be placed in the skinmesh folder
  - userTextureA.dds  - LightMap, this has to be a DXT1 dds texture, it will blend with the mesh texture, does not tile

0032_user_lightmap - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection
  Required textures - must be placed in the skinmesh folder
  - userTextureA.dds  - LightMap, this has to be a DXT1 dds texture, it will blend with the mesh texture, does not tile

0034_user_specmap_bumpy_glossy  - Supports all lightmodes sunlight, 4 pointlights, fog
  Required textures - must be placed in the skinmesh folder
  - 000_nm.<ext>      - Normalmap - (ext can be any supported image format .jpg .bmp .dds .png)
  - userTextureA.dds  - SpecMap, this has to be a DXT1 dds texture, it will add specular lighting to mesh texture, tiles.



0035_user_specmap_glossy  - Supports all lightmodes sunlight, 4 pointlights, fog
  Required textures - must be placed in the skinmesh folder
  - userTextureA.dds  - SpecMap, this has to be a DXT1 dds texture, it will add specular lighting to mesh texture, tiles.



0040_user_glowmap_bumpy - Supports all lightmodes sunlight, 4 pointlights, fog
  Required textures - must be placed in the skinmesh folder
  - 000_nm.<ext>      - Normalmap - (ext can be any supported image format .jpg .bmp .dds .png)
  - userTextureA.dds  - GlowMap, this has to be a alpha transparent DXT5 dds texture, it will blend with the mesh texture and tiles.

0041_user_glowmap_glossy - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection
  Required textures - must be placed in the skinmesh folder
  - userTextureA.dds  - GlowMap, this has to be a alpha transparent DXT5 dds texture, it will blend with the mesh texture and tiles.

Andro at daylight


Andro at night


0042_user_glowmap - Supports all lightmodes sunlight, 4 pointlights, fog, envmap reflection
  Required textures - must be placed in the skinmesh folder
  - userTextureA.dds  - GlowMap, this has to be a alpha transparent DXT5 dds texture, it will blend with the mesh texture and tiles.

0090_user_rgb2tx_bumpy_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Required textures - must be placed in the skinmesh folder
  - 000_nm.<ext>      - Normalmap - (ext can be any supported image format .jpg .bmp .dds .png) - (this is repeated 100 times by default)
  - userTextureA.dds  - Could be Rock texture, this has to be a DXT1 dds texture, this will mapped to mesh Red Color
  - userTextureB.dds  - Could be Grass texture, this has to be a DXT1 dds texture, this will mapped to mesh Green Color
  - userTextureC.dds  - Could be Sand texture, this has to be a DXT1 dds texture, this will mapped to mesh Blue Color
  Optional settings:
  1. you can repeat all 4 texture UV via "Bump texture Tiles" in the skinmesh dialog (optional via script)
  2. you can finetune individual texture UV repeatitions by a simple script using iShaderFloat4Set(OBJ_0,"tileRGBN",floatA,floatB,floatC,floatN) and link to skinmesh. (PS! this is multiplied with the number set in 1.)

Mesh Texture



Shader translate RGB to 3 textures


0094_user_rgb2tx_bumpy_adv_tile  - Supports all lightmodes sunlight, 4 pointlights, fog
  Required textures - must be placed in the skinmesh folder
  - userTextureA.dds  - Could be Rock texture, this has to be a DXT1 dds texture, this will mapped to mesh Red Color
  - userTextureB.dds  - Could be Grass texture, this has to be a DXT1 dds texture, this will mapped to mesh Green Color
  - userTextureC.dds  - Could be Sand texture, this has to be a DXT1 dds texture, this will mapped to mesh Blue Color

  Normalmapping for individual textures has to be set via script and can be placed anywhere
  - <userTextureA_NM.dds> - Normalmap for userTextureA (Use script to set, see below for example)
  - <userTextureB_NM.dds> - Normalmap for userTextureB (Use script to set, see below for example)
  - <userTextureC_NM.dds> - Normalmap for userTextureC (Use script to set, see below for example)

Example on how to set normalmaps for each texture
Code: [Select]
void Main()
{
    int nmA, nmB, nmC;

    if (iInitializing())
    {
      nmR = iShaderTextureCreate(".\\3DRad_res\\fxTextures\\userTextureA_NM.dds");
      nmG = iShaderTextureCreate(".\\3DRad_res\\fxTextures\\userTextureB_NM.dds");
      nmB = iShaderTextureCreate(".\\3DRad_res\\fxTextures\\userTextureC_NM.dds");
    }

    iShaderTextureSet(OBJ_0, "userTextureA_NM", nmA);
    iShaderTextureSet(OBJ_0, "userTextureB_NM", nmB);
    iShaderTextureSet(OBJ_0, "userTextureC_NM", nmC);
}

  Optional settings:
  1. you can repeat all 6 texture UV via "Bump texture Tiles" in the skinmesh dialog (optional via script)
  2. you can finetune individual texture UV repeatitions by a simple script using iShaderFloat4Set(OBJ_0,"tileRGBN",floatA,floatB,floatC,floatN) and link to skinmesh.
  (PS! this is multiplied with the number set in 1.)
  (PS! floatN has no effect here since individual normalmaps follow it's diffuse texture tiles)

Individual normal mapping
« Last Edit: July 14, 2011, 01:56:27 PM by shadmar »
« Reply #1 on: August 09, 2010, 10:09:19 AM »
Hi Shadmar, I've tested your shaders today (thanx for sharing) and I recognize a little different to the originals.
 
When I set the shader to one of yours and close the Skinmesh property window it takes around 5-8 seconds till the view changed but while waiting there is around 1 sec. while windows notifies 'no response' for 3DRad.  The original shaders are working without this message. ???
 
 
But maybe its my vista64 which sucked up again... (I ordered XP32 pro at ebay last weekend to kill the pain :P )
new forum search:
http://www.google.com/ site:www.3drad.com searchword  ( <-- copy )
3DRad is now in the same Brain-Area like my old C64 and Amiga Memories!
« Reply #2 on: August 09, 2010, 10:19:43 AM »
Might be bacuse they are .fx and not .fxo (compiled)
.fx needs to compile on the fly when you select it (guessing)

Why your windows go 'no response' is a windows setting (don't remember where to set it), but you can increase this, to tell windows when an application is considered to hang.

I submitted the shaders yesterday but I don't see them in the addon page yet. Is it just me?

EDIT: found them here : http://www.3drad.com/addons/SystemShaders1_shx.php

EDIT2 : I downloaded fxc from the directx sdk, and it can compile HLSL when preprosessor directives are used.
So next version will load alot faster :)
« Last Edit: August 09, 2010, 12:02:27 PM by shadmar »

leon

« Reply #3 on: August 09, 2010, 01:33:08 PM »
Thanks mate
working nice  :)
« Reply #4 on: August 09, 2010, 04:30:32 PM »
Great stuff shadmar, working like a charm ;)
Roll out!
http://www.youtube.com/watch?v=VD8MvMaPNO4

Do you have kids between the ages of 3 and 9?

http://www.amazon.com/dp/B007K1EFC6
« Reply #5 on: August 09, 2010, 05:03:38 PM »
Thanks, next update will have som fixes and compiled shaders wich is instant on selection like the default ones :)
« Last Edit: August 09, 2010, 05:06:41 PM by shadmar »
« Reply #6 on: August 10, 2010, 07:17:48 AM »
1.02 - Pointlight not illuminating diffuse texture when sun is black, fixed

All shaders are compiled HLSL and are instant/very fast on selection.
« Reply #7 on: August 10, 2010, 03:14:29 PM »
great work shad! thanks for mentioning fxc, as I had been wanting to look into that and forgot about it. now i can make .fxo files yay!
using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11
« Reply #8 on: August 10, 2010, 08:43:00 PM »
mm, one question here, the mesh need to have 2 uv's, one for the texturas and one for the lightmap right? i only see the model black when i set the shader to lightmap
« Reply #9 on: August 11, 2010, 12:07:20 PM »
No, you need one UV.
If there is no userTextureA.dds in the skinmesh dialog it will turn black.

Added some shots of a lightmap cave using the 0030_user_lightmap_bumpy shader.
It has one UV, repeated 8 times for the diffuse/bump (using the skinmesh dialog : bump texture tiles) + lightmap stretched across.
« Last Edit: August 11, 2010, 12:09:02 PM by shadmar »
« Reply #10 on: August 11, 2010, 12:12:40 PM »
Looking good shadmar  ;)
FPS game creator for 3drad and >2000 games GamesAtNight
« Reply #11 on: August 11, 2010, 12:29:30 PM »
Thanks, a tip for UV'ing caves, this is what I found best using Ultimate Unwrap 3D:

1. 2D-Tools -> UV-Mapping -> Planar -> 1 sided
2. 2D-Tools -> Relax UV (iterations : 200, Scale factor 1)
3. 3D-Tools -> AutoSmooth Faces (Angle 35)

« Reply #12 on: August 11, 2010, 12:33:13 PM »
Shadmar,

the texture shaders are ready to do this here:
http://www.3drad.com/forum/index.php?topic=4936

I infere so from you can finetune RGB color to texture by a simple script using iShaderFloat3Set(OBJ_0,"cColor",floatR,floatG.floatB) and link to skinmesh. however Im having a big time trouble to figure it out.

could bother you with an example?  :-[ :-[

great work on this shaders addons btw!!
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #13 on: August 11, 2010, 01:07:43 PM »
could bother you with an example?  :-[ :-[

Yes an example is here : http://www.3drad.com/forum/index.php?topic=5019.0 :)

the texture shaders are ready to do this here:
http://www.3drad.com/forum/index.php?topic=4936

Was this a question ? If so I think so.
Just need some time :)
« Reply #14 on: August 11, 2010, 01:17:58 PM »
the texture shaders are ready to do this here:
http://www.3drad.com/forum/index.php?topic=4936

Was this a question ? If so I think so.
Just need some time :)

yeah, it was a question, the question was if the texture shaders posted here (0030 to 0042) do what I was talking about in the linked thread.
I guess "Just need some time :)" means "no, not those, not yet".
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
Pages: [1] 2 3 ... 7