View Full Version : Using textures?
Soo88
17th February 2008, 19:00
Could anyone tell me how to load, and move a texture?
I put the file into the textures map, and it's called Billy.jpg.
Also, how can i move it around?
Thanks in advance!
Flexi
17th February 2008, 23:47
hey, have a look into the manual :p
sampler sampler_billy;
shader{
ret = tex2D(sampler_billy, uv);
}
this is the way to load and display your texture (stretched).
if you multiply the uv vector by texsize.xy*texsize_billy.zw
ret = tex2D(sampler_billy, 0.5 + (uv-0.5)*texsize.xy*texsize_billy.zw);
your texture should be scaled to its original size.
now just add a float2(offsetx,offsety) to move it around.
Moreover you can pass these values via the q1-q32 variables from the per-frame code to the shader.
ret = tex2D(sampler_billy, 0.5 + (uv-0.5)*texsize.xy*texsize_billy.zw + _qa.xy);
(with q1 = offset_x and q2 = offset_y in the per-frame code)
and as a little homework... go figure out the difference between
sampler_fc_billy,
sampler_fw_billy,
sampler_pc_billy &
sampler_pw_billy
:D :blah: ;)
(do you incidentally try kidding me? - the examples in the preset authoring guide are not just by accident also with "billy" or what?)
Soo88
18th February 2008, 11:37
yeah, i was trying to use the manual, but i didn't really understand it :P
The texture still doesn't seem to show up. This is what i've got now.
[preset00]
sampler sampler_billy;
shader{ret = tex2D(sampler_billy, uv);}
ret = tex2D(sampler_billy, 0.5 + (uv-0.5)*texsize.xy*texsize_billy.zw);
Flexi
18th February 2008, 14:02
...
sampler sampler_billy;
shader{
ret = tex2D(sampler_billy, 0.5 + (uv-0.5)*texsize.xy*texsize_billy.zw);
}
the ret expressions were ment to be replaced.
Soo88
18th February 2008, 17:19
Could you maybe point me to an example of a preset that uses textures?
Thanks!
Flexi
18th February 2008, 17:53
;)
Zylot
21st February 2008, 05:28
My "Age of Science" posted early uses moving textures, as do "My World" and "Blue Jewel" presets, for further examples
Patsy7z7
10th March 2008, 06:38
I think what he means is using a texture much like a sprite.
I do not believe that textures can be manipulated beyond stretching/tiling. What you are looking for is more along the lines of sprites. In which case, sprites are separate from the MilkDrop presets.
As far as i know, you cannot have a preset project a single image across the screen. Unless some very clever code has been developed without me knowing.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.