HSP¥Ý¡¼¥¿¥ë
¥µ¥¤¥È¥Þ¥Ã¥× ¤ªÌ䤤¹ç¤ï¤»


HSPTV!·Ç¼¨ÈÄ


̤²ò·è ²ò·è Ää»ß ºï½üÍ×ÀÁ

2022
0214
youdaiHGIMG4¤Ç²èÁü¤òÇÈÌæ¤ÇÇÈΩ¤¿¤»¤ë¥Ý¥¹¥È¥¨¥Õ¥§¥¯¥È¤ò¼ÂÁõ¤·¤¿¤¤2²ò·è


youdai

¥ê¥ó¥¯

2022/2/14(Mon) 08:22:17|NO.95410

HGIMG4¤Ç²èÁü¤òÇÈÌæ¤ÇÇÈΩ¤¿¤»¤ë¥Ý¥¹¥È¥¨¥Õ¥§¥¯¥È¤ò¼ÂÁõ¤·¤¿¤¤¤Ç¤¹¡£

ÇÈÌæ¤È¤¤¤¦¤Î¤Ï¿å¤ËÀФʤɤòÅꤲ¤¿¤È¤­¤Ë¤Ç¤­¤ë¡¢Îؤˤʤäƹ­¤¬¤Ã¤Æ¤¤¤¯ÇȤÎÌÏÍͤΤ³¤È¤Ç¤¹¡£
¤½¤ÎÇÈÌæ¤òË¡Àþ¤Î¸þ¤­¤È¤·¤Æ¼ÂÁõ¤Ç¤­¤ì¤Ð¡¢¤½¤ÎË¡Àþ¤Ç²èÁü¤¬ÇÈÌæ¤ÇÇÈΩ¤Ã¤¿¤è¤¦¤Ê¥Ý¥¹¥È¥¨¥Õ¥§¥¯¥È¤¬
¤Ç¤­¤ë¤Î¤Ç¤Ï¤Ê¤¤¤Î¤«¤È»×¤Ã¤¿¤Î¤Ç¤¹¤¬¡¢Ê£»¨¤Ç¤è¤¯Ê¬¤«¤ê¤Þ¤»¤ó¡£

ÍפÏsin´Ø¿ô¤äcos´Ø¿ôÅù¤ÇÀ¸À®¤µ¤ì¤ëÎؤò¡¢Ë¡Àþx¤ò-1.0¡Á1.0¤Ç¡¢Ë¡Àþy¤ò-1.0¡Á1.0¤ÇÇÈÌæ¤È¤·¤ÆÉÁ¼Ì¤¹¤ì¤Ð
ÇÈÌæ¤È¤·¤Æ¤ÎË¡Àþ¤¬À¸À®¤Ç¤­¤ë¤Î¤Ç¤Ï¤Ê¤¤¤«¤È»×¤¤¤Þ¤¹¡£

¤½¤ì¤«¤éÀ¸À®¤·¤¿ÇÈÌæ¤Î¿ô¤À¤±for¤Ç¥ê¥Ô¡¼¥È½èÍý¤ò¤·¤ÆË¡Àþ¤ò½èÍý¤¹¤ì¤Ð¡¢
ÇÈÌ椬ÇÈΩ¤Ã¤¿¤è¤¦¤ÊË¡Àþ¤¬À¸À®¤Ç¤­¤ë¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£

°Ê²¼¤Î¥Õ¥é¥°¥á¥ó¥È¥·¥§¡¼¥À¡¼¥Õ¥¡¥¤¥ë¤Ï¤¢¤¯¤Þ¤Çºî¤ê¤«¤±¤Î¥¤¥á¡¼¥¸¤Ç¤·¤«¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢
¤³¤¦¤¤¤Ã¤¿Ê·°Ïµ¤¤Î¤â¤Î¤òÁÛÄꤷ¤Æºî¤Ã¤Æ¤¤¤Þ¤·¤¿¡£

p_normalRipple.frag


// Uniforms uniform texture2D u_texture; uniform float u_radius; // ÇÈÌæ¤ÎȯÀ¸Ãæ¿´°ÌÃÖ¤ÎUVºÂɸ uniform float u_power; // ÇÈÌæ¤Î¹â¤µ¤Î¶¯¤µ uniform float u_time; // ·Ð²á»þ´Ö uniform float u_aspect; // ²èÌ̤Υ¢¥¹¥Ú¥¯¥ÈÈæ¡£ÇÈÌæ¤òÀµ±ß¤Ë¤¹¤ë»þ¤ËɬÍס© // Varyings varying vec2 v_texCoord; /* normalRipple_compute¤Î°ú¤­¿ô¤Ë¤Ä¤¤¤Æ uv = ÇÈÌæ¤ÎȯÀ¸Ãæ¿´°ÌÃÖ¤ÎUVºÂɸ radius = ÇÈÌæ¤ÎȾ·Â power = ÇÈÌæ¤Î¹â¤µ¤Î¶¯¤µ time = ·Ð²á»þ´Ö */ vec3 normalRipple_compute (vec2 uv, float radius, float power, float time) { vec3 normal; // Ë¡Àþ // ²¿¤é¤«¤Î½èÍý return normal; } // main void main() { vec3 normal; // ÇÈÌæ¤Î¿ô¤À¤±·«¤êÊÖ¤¹ // RIPPLE_COUNT¤Ïdefs¤Ç»ØÄꤹ¤ëÇÈÌæ¤Î¿ô for (int i = 0; i < RIPPLE_COUNT; ++i) { normal += normalRipple_compute(v_texCoord, u_radius, u_power, u_time); } vec2 uv = normal.xy; vec3 result = sampler2D(u_texture, uv); gl_FragColor = vec4(result ,1.0); }

ĺÅÀ¥·¥§¡¼¥À¡¼¤Ë¤Ä¤¤¤Æ¤Ï¥Ý¥¹¥È¥¨¥Õ¥§¥¯¥È¤Ê¤¿¤á¡¢Ä̾ï¤ÈÊѤï¤ê¤Þ¤»¤ó¡£

p_normalRipple.vert


// Attributes attribute vec3 a_position; attribute vec2 a_texCoord; attribute vec4 a_color; // Uniforms uniform mat4 u_projectionMatrix; // Varyings varying vec2 v_texCoord; void main() { gl_Position = u_projectionMatrix * vec4(a_position, 1); v_texCoord = a_texCoord; }

¥¢¥É¥Ð¥¤¥¹¤ª´ê¤¤Ãפ·¤Þ¤¹¡£



¤³¤Îµ­»ö¤ËÊÖ¿®¤¹¤ë


usagi

¥ê¥ó¥¯

2022/2/15(Tue) 04:31:05|NO.95426

°ìÎã¤È¤·¤Æ¡¢
¥Ý¥¹¥È¥¨¥Õ¥§¥¯¥È¤Ï2D¤Ê¤Î¤Ç¡¢Ë¡Àþ·×»»¤Ï¤·¤Ê¤¤¤Ç¥·¥ó¥×¥ë¤Ë¥Æ¥¯¥¹¥Á¥ãºÂɸ¤Î»²¾È¤òsin´Ø¿ô¤Ç¥·¥Õ¥È¤·¤Æ¤ß¤Þ¤·¤¿¡£
¤È¤ê¤¢¤¨¤ºÃæ¿´¤«¤éƱ¿´±ß¾õ¤ËÇÈÌ椬°ì¤Ä½Ð¤ë´¶¤¸¤Ë¤·¤Æ¤ß¤Æ¤¤¤Þ¤¹¡£
¤ª¤Þ¤±¤Çcos¤Ï90¡ë°ÌÁ꤬¥º¥ì¤Þ¤¹¤Î¤Ç¡¢¥Æ¥¯¥»¥ë¤Ë¾è»»¤·¤Æ´Ê°×±Æ¤Ä¤±¤Æ¤Þ¤¹¡£

¡¦wave.vert ¤Ï sprite.vart¤È°ì½ï¡Ê¥³¥Ô¥Ú¡Ë

¡¦wave.frag

uniform sampler2D u_texture; uniform float u_frequency; uniform float u_phase; uniform float u_amplitude; uniform float u_attenuation; varying vec2 v_texCoord; varying vec4 v_color; const float E = 2.718281828459045; const float PI = 3.141592653589793; const float PI2 = PI * 2.0; void main() { vec2 p = v_texCoord * 2.0 - 1.0; // 0~1¤ò-1~1¤ËÊÑ´¹ float dist = 1.0 - length(p); // ­¡Ãæ¿´¤«¤é¤Îµ÷Î¥ 1~-inf float atte = exp(1.0 - length(p) * u_attenuation) / E; // ­¢Ãæ¿´¤«¤é¤Î¸º¿ê 1~0 float theta = PI2 * u_frequency * dist; // ¼þÇÈ¿ô theta += u_phase; // °ÌÁê float amp = sin(theta) * u_amplitude * atte; // ­£¿¶Éý vec2 uv = v_texCoord + normalize(p) * amp; // ¥Æ¥¯¥¹¥Á¥ãºÂɸ¤ËÇÈÌæ²Ã»» uv = clamp(uv, 0.01, 0.99); // ü¤ò·«¤êÊÖ¤¹¤Ê¤é¥³¥á¥ó¥È¥¢¥¦¥È gl_FragColor = texture2D(u_texture, uv); // ³ÎǧÍÑ =================================== // ­¡Ãæ¿´¤«¤é¤Îµ÷Υɽ¼¨ //gl_FragColor = vec4(vec3(dist), 1.0); // ­¢Ãæ¿´¤«¤é¤Î¸º¿êɽ¼¨ //gl_FragColor = vec4(vec3(atte), 1.0); // ­£¿¶Éýɽ¼¨ //gl_FragColor = vec4(vec3(amp*0.5+0.5), 1.0); // ¥ª¥Þ¥±±Æ ÉÔÍפʤ饳¥á¥ó¥È¥¢¥¦¥È float light = (1.0 + (cos(theta)+1.0)*atte*0.1); vec3 col = texture2D(u_texture, uv).rgb * light; gl_FragColor = vec4(col, 1.0); }

¡¦Æ°ºî¥µ¥ó¥×¥ë

#include "hgimg4.as" s = 512 : div = 32 : mode = 0 freq = 2.0 : amp = 0.01 : attenate = 1.0 : phase = 0.0 screen 0, s,s gpreset gpusershader "wave.vert", "wave.frag", "" buffer 1,s,s,screen_offscreen + screen_usergcopy gpgetmat wave_mat, 1, GPGETMAT_OPT_SCRMAT gpmatprm1 wave_mat, "u_frequency", freq gpmatprm1 wave_mat, "u_amplitude", amp gpmatprm1 wave_mat, "u_attenuation", attenate *GEN_TEX dim bitmap,s*s if mode = 0 {; ¥¿¥¤¥ë repeat s*s tcnt = cnt/div : bitmap(cnt) = ((tcnt\s+tcnt/s)\2==0)*$FFC0C0C0-$00404040 loop } else {; ¥«¥é¡¼ repeat s*s tcnt=cnt*256/s : bitmap(cnt) = tcnt\s+((tcnt/s)<<8)+((s-tcnt\s)<<16) loop } celbitmap 1,bitmap gsel 0 *MAIN stick pad,$3e800 : if pad&16 : mode^=1 : goto *GEN_TEX if pad & $04000 : freq-=0.1 if pad & $10000 : freq+=0.1 if pad & $08000 : amp+=0.001 if pad & $20000 : amp-=0.001 if pad & $00800 : attenate = limitf(attenate-0.1, 0.0) if pad & $02000 : attenate+=0.1 if pad { gpmatprm1 wave_mat, "u_frequency", freq gpmatprm1 wave_mat, "u_amplitude", amp gpmatprm1 wave_mat, "u_attenuation", attenate } gpmatprm1 wave_mat, "u_phase", phase : phase += 0.1 redraw 1 : await 16 : redraw 0 : color : boxf pos 0, 0 : celput 1 rgbcolor $FFFFFF : pos 0,0 mes strf("freq: %4.2f, amp: %4.2f, attenate: %4.2f, phase: %4.2f", freq, amp, attenate, phase),4 mes strf("[<-A D->] Freq: %4.2f", freq),4 mes strf("[<-W S->] Amp: %4.2f", amp),4 mes strf("[<-Z C->] Attenate: %4.2f", attenate),4 mes strf("[ Space ] Texture: %d", mode),4 mes strf("Phase: %4.2f", phase),4 goto *MAIN

¿åÅ©¥¨¥Õ¥§¥¯¥È¤È¤«ºî¤Ã¤¿¤é¥«¥Ã¥³¤è¤µ¤½¤¦¤Ç¤¹¤Í¤§¡£



youdai

¥ê¥ó¥¯

2022/2/15(Tue) 19:47:34|NO.95431

ÊÖ¿®¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£
ÂçÊÑ»²¹Í¤Ë¤Ê¤ê¤Þ¤·¤¿¡£
wave.frag¤Îp¤ÎºÂɸ¤Ë²Ã»»¤¹¤ë¤³¤È¤Ç¡¢ÇÈÌæ¤ò½Ð¸½¤µ¤»¤ë°ÌÃÖ¤òÊѹ¹¤Ç¤­¤ë¤³¤È¤âʬ¤«¤ê¤Þ¤·¤¿¡£
¸«±É¤¨¤â¤È¤Æ¤âÁÇÀ²¤é¤·¤¯¡¢ÂçÊÑÎɤ¤¥Ý¥¹¥È¥¨¥Õ¥§¥¯¥È¤À¤È»×¤¤¤Þ¤·¤¿¡£
¤³¤ì¤Ï¤È¤Æ¤âÀ¨¤¤¤È»×¤¤¤Þ¤¹¡£
¼ÂºÝ¤Ë¥µ¥ó¥×¥ë¤òÆ°¤«¤·¤¿»þ¤Ë´¶Æ°¤·¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£



ONION software Copyright 1997-2023(c) All rights reserved.