|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: fogman]
#119605
05/01/07 14:02
05/01/07 14:02
|
Joined: Nov 2004
Posts: 7,121 Potsdam, Brandenburg, Germany
Machinery_Frank
Senior Expert
|
Senior Expert
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
|
I am also excited. Will this also work with shaders? I would like to re-create something like this: or this: I already tried something like that with the sphere plug-in: The advantage of this method over sphere is: We could use a scene-management therefore it should be possible to create bigger worlds. If I could blend a shadowmap over a scene with normal-mapping then it would be fantastic. We could even fake static lights with this method. Visuals as seen in games like Riddick, Doom3, Quake4 (and so on) could be possible. If someone is willing to help me with scripting and shaders then we could make a little techdemo together.
Models, Textures and Games from Dexsoft
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: Machinery_Frank]
#119606
05/01/07 15:00
05/01/07 15:00
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
I could easily adapt my normal-mapping shader to work with lightmaps. The only problem would be "baking" the shadows for the models. I'm planning on buying sphere soon...
xXxGuitar511 - Programmer
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: xXxGuitar511]
#119607
05/01/07 15:05
05/01/07 15:05
|
Joined: Nov 2004
Posts: 7,121 Potsdam, Brandenburg, Germany
Machinery_Frank
Senior Expert
|
Senior Expert
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
|
Shadow-baking will be done in Lightwave. That is no problem. The problem is:
Blending 2 uv-sets over each other. The first one contains normal-mapping or parallax shader (with tileable textues) and the second one contains a lightmap (non-tileable). The lightmap can even contain colors to simulate static lights.
A simple multiplication of the lightmap should do the job. But it must take a different uv-map into consideration.
Maybe Ventilator already has a solution for that.
Models, Textures and Games from Dexsoft
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: Machinery_Frank]
#119609
05/01/07 15:17
05/01/07 15:17
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
a solution for what? you can apply materials and shaders and use the light map (or any other texture which uses the second uv-set) in any way you want. i am not sure though how well mixing per pixel lighting with a static light map works or how it looks like since i have never tried that. @william: yes. it's like ent_morph(). ... there still is one problem. if ent_setmesh() gets used in my plugin then the engine crashes once it gets closed. i think either i do something wrong with compiling and linking or it's a problem on jcl's side. and maybe i will try to make ent_loadseconduvset() faster. first i wanted to use c only so that it will also work with lite-c but i think by using some c++ stuff it could be much faster.
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: ventilator]
#119610
05/01/07 18:50
05/01/07 18:50
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
here is a beta version of the plugin: mesh.zip ~3.8mb try it at your own risk! it will only work with the latest a6/a7 beta! ent_loadseconduvset() is so fast now that the import/export functions probably won't be needed anymore. i didn't test the new algorithm very thoroughly but it seems to work at a first glance. my example model isn't that great. it has a poor light map resolution and seams at some areas. the beta only works for meshes up to 2500 faces. known issue: the engine will crash if you close it! some screenshots of your tests would be nice!
|
|
|
Re: [Plugin] Import von 2. UVMap / Import of 2nd U
[Re: ventilator]
#119614
05/02/07 10:30
05/02/07 10:30
|
Joined: Aug 2001
Posts: 2,320 Alberta, Canada
William
Expert
|
Expert
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
|
Brilliant Ventilator! Let me work with it a bit more, then I can provide an analysis(already got my ps/vs detailmapping shader with lightmap applied). Collision seems good all around too(c_trace/c_move, ect.)! Thanks for the demo. @Frank - Quote:
A simple multiplication of the lightmap should do the job. But it must take a different uv-map into consideration.
Looks like this shouldn't be a problem. Heres what I had to do in my shader:
put a shadowmap sampler:
sampler shadowmap = sampler_state { Texture = (mtlSkin3); MINFILTER = LINEAR; MIPFILTER = LINEAR; MAGFILTER = LINEAR; };
Then, in the structs, I put a second set of texture coordinates. I think all shaders use "texCoord0". For having a lightmap, it looks like it's texCoord1.
struct VS_INPUT0 { float4 pos: POSITION; float2 texCoord0: TEXCOORD0; //1st uvmap coordinate set float2 texCoord1: TEXCOORD1; //2nd uvmap coordinate set float4 normal: NORMAL; };
struct VS_OUTPUT0 { float4 pos: POSITION; float2 texCoord0: TEXCOORD0; //Used for colormap float2 texCoord1: TEXCOORD1; //Used for detail1 float2 texCoord2: TEXCOORD2; //Used for detail2 float2 texCoord3: TEXCOORD3; //Used for shadowmap float4 diffuse: COLOR; float fog: FOG; };
struct VS_OUTPUT2 { float4 pos: POSITION; float4 diffuse: COLOR; };
struct PS_INPUT0 { float2 texCoord0: TEXCOORD0; //Used for colormap float2 texCoord1: TEXCOORD1; //Used for detail1 float2 texCoord2: TEXCOORD2; //Used for detail2 float2 texCoord3: TEXCOORD3; //Used for shadowmap float4 diffuse: COLOR; };
Put this in your vs_output():
Out.texCoord3 = In.texCoord1;
And simply in the ps_main:
float4 color = tex2D(colorMap,In.texCoord0); float3 texture0 = tex2D(detail0, In.texCoord1); float3 texture1 = tex2D(detail1, In.texCoord2); float4 shadow = tex2D(shadowmap, In.texCoord3);
return (color*vecAmbient+(color * In.diffuse))*shadow;
I don't know if your supposed to multiply by the shadow, as I'm no shader programmer(and admit, took a few minutes to even figure this out). But it works, and also colored lighting on the light maps work too!
|
|
|
|