View Single Post
Old 18th June 2020, 05:10   #1
NeonAngel
Junior Member
 
Join Date: Jun 2020
Posts: 7
Aspect Ratio for Preset Sampler Images

I have a problem trying to get sampler images used in presets to display without any stretching. In the example below (see .milk file attached), the image displays correctly if it is a SQUARE image - so it will just touch each side, with no distortion, and the top and bottom are correctly cropped. (see first image - the white area illustrates what screen will look like in widescreen). Perfect.



If it is a wide or tall image though, it will be horribly distorted and will only look perfect when the image's aspect ratio matches EXACTLY the screen's aspect ratio. What am I doing wrong?

warp_1=`sampler sampler_mandala;
warp_2=`
warp_3=`shader_body
warp_4=`{
warp_5=` // sample previous frame
warp_6=` ret = tex2D( sampler_mandala, uv);
warp_7=`}
comp_1=`shader_body
comp_2=`{
comp_3=` ret = tex2D(sampler_main, (uv-0.5)*aspect.xy+0.5).xyz; //Works OK only if image ratio is SQUARE
comp_4=` ret *= 1.00; //gamma
comp_5=`}

Image is very distorted on a square screen:


Original tall image - the white area shows what it should look like on a square screen:


Widescreen image - the white area shows what it should look like on a square screen:


I am busy preparing a comprehensive set of sampler presets for a new MilkDrop based VJ application called NestDrop. It will also include a new sprite function that is going surprise quite a few people! 8196x8196 at 60fps x 4 screens is possible - all with full spout output to any compatible application - and free!
Attached Files
File Type: milk SAMPLER-xmuzack + cope - milkboom.milk (2.0 KB, 73 views)
NeonAngel is offline   Reply With Quote