Forums > Jitter

stroke texture jit.gl.sketch

September 22, 2006 | 5:28 pm

I’m trying to recreate the textured stroke in jsui_splinestuff-example using jit.gl.sketch, but the texture part won’t work. I read from some previous posts mentioned about tesselating the stroke but I didn’t see any action like that in the jsui_splinestuff-example. Here is the part of the js code I used to create the stoke (I wrote this by mimicing jsui_splinestuff-example). Could anyone help me find out why the texture is not working?

Thanks in advance,

var mystroke=new JitterObject("jit.gl.sketch","ListenWindow");
function drawstroke()
{
var img = new Image("brush01alpha.tif");
mystroke.reset();
mystroke.glenable("texture");
mystroke.glbindtexture(img);

mystroke.cmd_insert(0,"beginstroke","basic2d");
mystroke.cmd_insert(1,"strokeparam", "order", 3);
mystroke.cmd_insert(2,"strokeparam","slices",20);
mystroke.cmd_insert(3,"strokeparam","color",cred[0],cgreen[0],cblue[0]);
mystroke.cmd_insert(4, "strokeparam","scale",cscale[0]*vscalerange);

for(var k=0;k<8;k++)
{
mystroke.cmd_insert(5+k*4, "strokeparam","scale",cscale[k]*vscalerange);
mystroke.cmd_insert(6+k*4,"strokeparam","color",cred[k],cgreen[k],cblue[k]);
mystroke.cmd_insert(7+k*4,"strokeparam","texture",k/7.0);
mystroke.cmd_insert(8+k*4,"strokepoint",cx[k],cy[k],cz[k]);
}
mystroke.cmd_insert(37,"endstroke");

}


September 22, 2006 | 6:44 pm

On Sep 22, 2006, at 10:28 AM, xiaohua sun wrote:

>
> I’m trying to recreate the textured stroke in jsui_splinestuff-
> example using jit.gl.sketch, but the texture part won’t work. I
> read from some previous posts mentioned about tesselating the
> stroke but I didn’t see any action like that in the
> jsui_splinestuff-example. Here is the part of the js code I used to
> create the stoke (I wrote this by mimicing jsui_splinestuff-
> example). Could anyone help me find out why the texture is not
> working?

jit.gl.sketch doesn’t support the JSUI sketch Image class. You need
to load into a movie or matrix, send that matrix to an instance of
jit.gl.texture and then use the texture name in the
jit.gl.bindtexture call.

-Joshua


September 23, 2006 | 12:40 am

Hi Joshua,

Thank you very much for your reply. I created the jit.gl.texture instance and use it for the glbindtexture. The texture got assinged to the stroke when I experimented with some moives and images, but it seems that the texture is not applied to the stroke as a single piece. and also those two brush tif files don’t work.

I’m working on a project in which the textured stroke effect in jsui_splinestuff-example.pat is very very important for me. Could you do me a favor and make a simple patch to show how this would work with jit.gl.sketch?

Thanks a lot,

genr


September 24, 2006 | 1:08 am

When I rotate the jit.window in which I draw the (badly) textured stroke, I just realized that it is actually a flat thing with no z dimension. What I’m looking for is something 3d (I can navigate around it) and have the same brush effect like in the jsui_splinestuff-example.pat. Is this something possible to be done in jitter or max?

I had ever created 3d strokes in Maya using my wacom pen, but the rendering process is so painful and the mel coding crashes very often. Above all, it is not real time. It will be great if there is a way to make the 3d stroke working in jitter.

Any suggestion will be very appreciated.

genr


September 24, 2006 | 8:48 am

have you looked into xray.jit.line2quad

2006/9/24, xiaohua sun :
>
>
> When I rotate the jit.window in which I draw the (badly) textured stroke,
> I just realized that it is actually a flat thing with no z dimension. What
> I’m looking for is something 3d (I can navigate around it) and have the same
> brush effect like in the jsui_splinestuff-example.pat. Is this something
> possible to be done in jitter or max?
>
> I had ever created 3d strokes in Maya using my wacom pen, but the
> rendering process is so painful and the mel coding crashes very often. Above
> all, it is not real time. It will be great if there is a way to make the 3d
> stroke working in jitter.
>
> Any suggestion will be very appreciated.
>
>
> genr
>


September 24, 2006 | 9:53 pm

Thank you very much for the information.

I downloaded the xray external objects, and got the "load old CFM externals disabled" error with MAX4.6, then I tested with MAX4.5.7, it works there, but this might be a problem because all my other pieces are built in 4.6.

I then looked at xray.jit.line2quad.pat, and found that it is different from what I’m looking for. The external generates equal sized quads at 3d points along a curve oriented based on the tangent at each point. the texture is then applied to each quad individually.

What I want to have are those features in jusi sketch, I can defined the color, width and texture coordinate at each control point of a stroke. Also the capability to use texture with alpha chanel. Of course, I need a 3D version of these features.

Thanks anyway for your help,

genr


September 24, 2006 | 10:19 pm

If you want UB version of the xray object, see this link:

http://www.mat.ucsb.edu/~whsmith/xray-mac-UB.zip

My webserver switch machines and something has gone awry with the
site. Sorry about that. You can adjust the length of the line2quad
object’s quads with the scale param. You can also enable/disable
normalization.

wes

On 9/24/06, xiaohua sun wrote:
>
> Thank you very much for the information.
>
> I downloaded the xray external objects, and got the "load old CFM externals disabled" error with MAX4.6, then I tested with MAX4.5.7, it works there, but this might be a problem because all my other pieces are built in 4.6.
>
> I then looked at xray.jit.line2quad.pat, and found that it is different from what I’m looking for. The external generates equal sized quads at 3d points along a curve oriented based on the tangent at each point. the texture is then applied to each quad individually.
>
> What I want to have are those features in jusi sketch, I can defined the color, width and texture coordinate at each control point of a stroke. Also the capability to use texture with alpha chanel. Of course, I need a 3D version of these features.
>
> Thanks anyway for your help,
>
> genr
>


Viewing 7 posts - 1 through 7 (of 7 total)