Q3D V-2.4 [3D Physics + Skeletal Animation UPDATE]

Post your completed addons to share with the community

Post » Fri Jul 24, 2015 5:08 am

I'm trying to get shadows casting from models with alpha transparency.
I found this:
http://threejs.org/examples/webgl_animation_cloth.html
Which does what I'm trying to do, but I'm trying to figure out a way to apply this effect in Q3D..
I've looked at the qfxloader and I've made this file:
Code: Select all
<shadertype>ShaderMaterial</shadertype>
<vertexshader>
varying vec2 vUV;

void main() {

   vUV = 0.75 * uv;

   vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );

   gl_Position = projectionMatrix * mvPosition;

}
</vertexshader>
<fragmentshader>
uniform sampler2D texture;
varying vec2 vUV;

vec4 pack_depth( const in float depth ) {

   const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
   const vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
   vec4 res = fract( depth * bit_shift );
   res -= res.xxyz * bit_mask;
   return res;

}

void main() {

   vec4 pixel = texture2D( texture, vUV );

   if ( pixel.a < 0.5 ) discard;

   gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );

}
</fragmentshader>

And I tried loading it via the action to "set material to shader."
It doesn't give any errors, so I assume it loads, but it doesn't change anything. It doesn't cast the shadows correctly.
I have alphatest set at 0.5, and I have blending set off. And I've also tried without those settings.

Any help getting shadows cast correctly for models with alphatest set would be great. I need it to take into consideration the alpha when casting shadows.

I notice in the example they have this set:
Code: Select all
object.customDepthMaterial = new THREE.ShaderMaterial( { uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader } );

I think that might be important? (customDepthMaterial)
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Sat Jul 25, 2015 1:24 am

Here is a visual example of the problem:
http://stackoverflow.com/questions/1624 ... ture-alpha
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Tue Jul 28, 2015 5:11 pm

@prominent

yea, you need the custom depth material for it to work, but as i've said the shader loader is incomplete and doesn't allow for these kinds of adjustments yet (you can only affect the main material, so some things can't be changed yet). This is why i don't recommend using it. Even though you've reverse engineered it, it'll probably be changed in a future update so you'll have issues when migrating if you're using the current qfx loader.

Also, systems like custom depth material which give low level access are a bit iffy in three.js itself at the moment if i recall. I need to investigate more.
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

Post » Tue Jul 28, 2015 11:01 pm

Sup!

Before anything else: QuaziGNRLnose deserves major credits for maintaining Q3D, granting sweet features (skeletal animation?! 3D physics?!) and also for just being so friggin' amazing. I'm a having a ton of fun playing around with Q3D, since it's surprisingly user friendly due to it's design and integration with C2's interface. All in all, I'm very pleased with the extension :D

Now, I'm working on a project (of course) with Q3D, and I'm wondering ... How would one go about achieving cell shading? (Simple toon shading, that is - outlines or not)
I've noticed the Shader property below the Material Type property in a Q3DModel, asking for a .qfx GLSL file - But what is that, exactly? Google is kind of inconclusive when it comes to answering that, could you point me in the right direction if I'd want/have to write a cell shading .qfx myself? Or is there a place where such finished, default GLSL shading algorithms can be acquired/downloaded premade in .qfx form, and be usable for Q3D?

Thanks in beforehand :)

edit: After reading the above post, I guess I should wait until a later update before I try getting cell shading to work, or is there something I could test in the meanwhile?
How's the work regarding extending the .gfx capabilites going, if I may ask in a patient manner? Cheers!
B
7
S
1
Posts: 21
Reputation: 475

Post » Tue Jul 28, 2015 11:31 pm

Thanks for the clarification @QuaziGNRLnose
QuaziGNRLnose wrote:Also, systems like custom depth material which give low level access are a bit iffy in three.js itself at the moment if i recall. I need to investigate more.

Please do, it would be great to have access to it so that the effect I'm after can be attained. I have a game I began making that requires it but I'll have to wait until there is a way to activate the effect I guess..
also, thanks for developing this plugin.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Wed Jul 29, 2015 12:26 pm

Two questions:

1: Would this be possible with your addon:
youtube link: /watch?v=BhwtIs5J8Ns

2: Would a crossy road player movement be possible?

Thanks :)
B
4
S
1
Posts: 12
Reputation: 374

Post » Wed Jul 29, 2015 4:41 pm

@frozze , I remember Quazi stating that you can't modify an object's geometry with his plugin, so I don't think your first question is possible.
I'm pretty sure the second question is possible though.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Fri Jul 31, 2015 12:44 pm

Man, this is so much fucking fun to play around; fantastic stuff.

One question @QuaziGNRLnose :

It seems like when I deactivate 'Debug body' in an object's 3D Physics settings it's the same as disabling 3D Physics completely, even though to my knowledge the only thing that should happen if you deactivate 'Debug body' is that the debug body basically turns transparent, am I correct?

In my example, I'm working on a top-down view system. I was working on a ramp and this works fine with debug body enabled; the player can run towards the ramp and it moves him along the Z axis, like it should. But when I disable the debug body for the ramp it has the same 'hit box' as a normal box.
B
7
S
2
Posts: 24
Reputation: 567


Post » Sat Aug 01, 2015 4:49 am

@nibel

Debug bodies shouldn't affect the physics at all, and in my testing they never did. Are you 100% sure this is whats happening?

@frozze

crossy road is very possible, it's essentially 2D gameplay so you could get away without even using 3D physics. The rendering of course is also very easy to attain

that fracturing however is not easily attainable. You can kind of fake it but getting the real effect wouldn't be possible cause the physics only supports simple primitives or built up objects made of simple primitives (box,sphere,cyclinder).

@kmsravindra

I'm still too busy to work on Q3D atm.

@polygallon

You can fake cell shading somewhat, by having a larger shell mesh with reversed normals/backface rendering. The shading itself wont be cell but you'll get the "toon" outline, and could play with the specularity/ambient settings to obtain some kind of toonish look.
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests