Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - cremen

Pages: [1]
1
Feature requests, suggestions / Shader control request.
« on: October 03, 2009, 08:55:20 AM »
Need a script command for runtime change shader constants. Something like this:
actor.SetShaderConstantVec4( "BorderColor", 1.0, 0.0, 0.0, 0.0 );
actor.SetShaderConstantVec1( "BorderWidth", 5.0 );
actor.SetTexture( "g_MeshTexture", "actors\\fx\\glow12.jpg");
Additionaly needs the shader constant setters in actor definition file. (like texture setting, constant and others)

where constants defined like this:
Code: [Select]
float4 BorderColor = { 1.0, 0.0, 0.0, 0.7 };
float BorderWidth = 4.0;

texture g_MeshTexture<
    string ResourceName = "actors\\inga\\inga.jpg";
>;

2
First of all, feature request:
Need a script command for runtime change shader constants. Something like this (look a shader constant at border shader):
actor.SetShaderConstantVec4( "BorderColor", 1.0, 0.0, 0.0, 0.0 );
actor.SetShaderConstantVec1( "BorderWidth", 5.0 );
actor.SetTexture( "GlowTexture", "actors\glow12.jpg");
Additionaly needs the shader constant setters in actor definition file. (like texture setting, constant and others)

Border shader (Simple outer glow). Useful for some selection effects. (Sometimes for 'show hidden objects' effect with one trick)
Code: WME Script
  1. float4x4 Wm: World;                 // World matrix for object
  2. float4x4 WvpM: WorldViewProjection;    // World * View * Projection matrix
  3. float4   LightPos: ActorLightPos;
  4.  
  5. float4 BorderColor = { 1.0, 0.0, 0.0, 0.7 };
  6. float BorderWidth = 4.0;
  7.  
  8. texture g_MeshTexture<
  9.     string ResourceName = "actors\\inga\\inga.jpg";
  10. >;
  11.  
  12. // Data structure for Vertex Shaders
  13. struct invs_data {
  14.     float4 Position     : POSITION;
  15.     float3 Normal       : NORMAL;
  16.     float2 UV      : TEXCOORD0;
  17. };
  18.  
  19. // Data structure for Pixel color shader
  20. struct outvs_data {
  21.     float4 Position     : POSITION;
  22.     float2 UV      : TEXCOORD0;
  23.         float4 Diffuse  : COLOR0;
  24. };
  25.  
  26. outvs_data VertShader(invs_data IN){
  27.         float4 pos = mul(IN.Position, WvpM);
  28.         float3 lightDir = normalize(LightPos-pos);
  29.  
  30.         outvs_data OUT = (outvs_data)0;
  31.         OUT.UV = IN.UV;
  32.         OUT.Diffuse = dot( IN.Normal, lightDir );
  33.         OUT.Position = pos;
  34.         return OUT;
  35. }
  36.  
  37. sampler MeshTextureSampler =
  38. sampler_state
  39. {
  40.     Texture = <g_MeshTexture>;
  41.     MipFilter = LINEAR;
  42.     MinFilter = LINEAR;
  43.     MagFilter = LINEAR;
  44. };
  45.  
  46. float4 PixShader(outvs_data IN): COLOR0 {
  47.         float4 col = max(0.4, IN.Diffuse) * tex2D(MeshTextureSampler, IN.UV);
  48.         return float4( col.xyz, 1.0);
  49. }
  50.  
  51. float4 GlowVertShader(invs_data IN): POSITION{
  52.         float4 pos = mul(IN.Position, WvpM);
  53.         float4 nrm = normalize(mul(IN.Normal, WvpM));
  54.         return pos + nrm * BorderWidth;
  55. }
  56. float4 GlowPixShader(float4 pos: POSITION): COLOR0 {
  57.         return BorderColor;
  58. }
  59.  
  60. technique Main{
  61.          pass glowPass{
  62.                 VertexShader = compile vs_2_0 GlowVertShader();
  63.                 PixelShader = compile ps_2_0 GlowPixShader();
  64.                 ZWriteEnable=false;
  65.                 //ZTest=true;
  66.                 CullMode = None;
  67.         }
  68.         pass colorPass{
  69.                 VertexShader = compile vs_2_0 VertShader();
  70.                 PixelShader = compile ps_2_0 PixShader();
  71.                 ZEnable=true;
  72.                 ZWriteEnable=true;
  73.                 //CullMode = None;
  74.         }
  75. }
  76.  

Result:


To be continued, stay turned.

3
Just subject. Not only black, may be custom picture or just color;

Thanks for your superb engine.

4
Общий фор�?м / PinkTown: Destination Lola
« on: September 25, 2009, 02:29:42 PM »
Недавно обнар

5
Can't reproduce / Project dont run from ProjectMan.
« on: February 13, 2009, 07:27:36 PM »
subj.

after pressing run button -> appear message box with text: "Some of the essential game files cannot be loaded. Please reinstall the game and try again.".

with any project.

P.S. Win7. WME 1.8.009
P.P.S. ProjectMan log is clean.

6
Not a bug / Entity inventory not saved then i live scene.
« on: May 06, 2008, 08:15:40 PM »
Is it right behavior?

for WME_DEMO

at OldGuy.script i added code:

Code: [Select]
on "LeftClick"
{
  GoToObject();
  if( this.HasItem("Book") ){
this.DropItem("Book");
Game.TakeItem("Book");
  };
}

on "Book"
{
  GoToObject();
  Game.Interactive = false;
  Game.DropItem("Book");
  this.TakeItem("Book");
  Game.Interactive = true;
}

and then i give this guy book (Lovely WME Tutorial, i think) and after go to street, and go back... his inventory empty... is it right? (hey, OldGay, give back my book!!!)

P.S. sorry for my pure English.

Pages: [1]

Page created in 0.046 seconds with 18 queries.