Chaingun said:Conceptually you can just add an offset to vertex position modulated by sine functions of time + position. Now I have no idea for Warband whether you can edit vertex shader and if so whether there's a time parameter to modulate with.
Computica said:I've been trying to figure out how to make the plant/tree shaders wobble. Does anyone know how to that in HLSL?Barabas said:Alright, well it is supposed to work :p
Everything multiplies there anyway, so.
If you have any other cool ideas for ways of using textures or anything. I'm all ears. I can't really think of anything
float3 P = mul(matWorldView, vPosition); //position in view space
//apply fog
float d = length(P);
float4 vWorldPos = (float4)mul(matWorld,vPosition);
Out.Fog = get_fog_amount_new(d, vWorldPos.z);
return 1.0f / exp2(d * fFogDensity);
Barabas said:What it does is this:
And get_fog_amount_new does nothing else then call get_fog_amount(d) which is:Code:float3 P = mul(matWorldView, vPosition); //position in view space //apply fog float d = length(P); float4 vWorldPos = (float4)mul(matWorld,vPosition); Out.Fog = get_fog_amount_new(d, vWorldPos.z);
Code:return 1.0f / exp2(d * fFogDensity);
So it could be fairly easy to add that in the pixel shader.
xenoargh said:Hmm. Maybe it's sending that to the post-fx? I haven't looked much at that yet; one thing I want to do eventually is calm down the OMG BLOOM if you set it to HSL High, and maybe do some other tweaks to color correction... if I run out of more useful stuff to do.
Oh, and in terms of playing around with pixel shaders, since you asked...
1. I'd like a shader that implements translucence and doesn't cull backfaces. Uses a normalmap and specular, preferably the skybox cube. Yeah, yeah, render-order issues and such; it won't be perfect but it should look OK for most uses.
I think I just did that for the newest version of Vikingr, sort of. I edited the envmap shader and made it way more sensible and accept a normalmap! =Dxenoargh said:2. I'd really, really, really, really like a shader that takes the skybox cubemap (see the water) and uses that in the pixel shader of a normalmapped, specular-friendly thing. Imagine how nice armor would look, using cheap fake reflections (when not in shadow). It's not entirely cheap, IDK whether it's practical on typical hardware yet, but I'd love to test it and find out.
Hmm.... haven't looked at that at all yet.xenoargh said:3. I'd like a non-junky exact lighting model for point lights, so that it's no longer using vertex lighting indoors. If you can get that done, I'd really appreciate seeing the code and getting help with the hair shader; it's looking pretty good outdoors but indoors it remains meh.
You mean use the alpha channel for specular lighting? To me it seems that it should already do this, however, Ive not yet tried it out or figured out how it works exactly in the code.xenoargh said:4. I'd like a version of standart_shader to implements glow, preferably in a way that's post-fx friendly (i.e., bloom). That's probably the lowest-hanging fruit of all; IIRC the current shader's already reading the alpha channel, so obviously it's all set up and ready. I'd really dig being able to use that for a number of things.
xenoargh said:Anyhow, this is my want list; I'd prefer PS / VS 2.a rather than 3, though; that cuts off some important tools but I figure 3.x is probably a bigger block than 2.a, at least under DX9, and a lot of players are using XP (and so am I).
Vincenzo said:Barabas said:*snip*
I would advise against using such calculations in the pixel shader, since pixel shaders are executed millions of times per object where as vertex shaders are executed per vertex, it is far more efficient to do pre-calculations in the vertex shader, and pass their results towards the pixel shader.
Why it doesent work with VS 3.0/PS3.0 not entirely sure, however I'd advice against using VS/PS 3.0 in warband simply because the engine is not set up for it at all, Your better off fitting everything within the PS2/VS2 limits. that includes performance reasons.
No, just simple self-illumination, i.e., it glows in the dark, ignoring lighting results according to a control variable, usually an alpha channel (I built a shader that used RGB for spec, glow and reflect values once, because RGB DXT1 is as cheap as an alpha for DXT5 in terms of memory).You mean use the alpha channel for specular lighting? To me it seems that it should already do this, however, Ive not yet tried it out or figured out how it works exactly in the code.
I don't think the skyboxes use cubemaps, but you should be able to. To tell the engine that the environment texture is a cubemap you need to set the 0x40 flag (I think it's the 7th in the OpenBRF dialog: "unused (?)").xenoargh said:2. Envmap: I'd love to see the code for using an envmap, but what I really want is for it to reflect the skybox, so that it'll be closer to environmental conditions. You've said "it's not a cube" twice- could've sworn the skyboxes used cubemaps, guess I'll have to check it out.
xenoargh said:*snip*
That is interesting, and will need to be tested; I'm used to working with cubemaps, not the way they've set these up. You're absolutely right, they're images wrapped around a sphere in an odd way, and they don't have a "ground", which explains a lot of things.I don't think the skyboxes use cubemaps, but you should be able to. To tell the engine that the environment texture is a cubemap you need to set the 0x40 flag (I think it's the 7th in the OpenBRF dialog: "unused (?)").
xenoargh said:I really honestly think that the standart_shader is not written for best performance (GPUs do not like IF statements and lots of conditional checks) so eventually I'll be splitting it out to two versions, one with spec and all bells and whistles, one without, if the engine will let me