Posted: 14th Jul 2017 12:41
Try SetObjectDepthWrite(ObjectID,1) + SetObjectTransparent(ObjectID,1)
Posted: 14th Jul 2017 22:49
No luck. The real issue is that the white area at the base of the tree should be transparent. It's transparent in the texture
I attached the model and texture
Posted: 15th Jul 2017 2:54
I found no transparency in the texture at all
I'll try it [s]next[/s] this morning ...to be sure
Posted: 15th Jul 2017 8:23
I'm such a fool!!!!! Sorry to waste your time janbo
Posted: 15th Jul 2017 12:02
No problem, I had those times too
I'm glad you found your problem...looks like a nice project
Posted: 24th Jul 2017 17:07
I made a thread for AppShaderKit in the Showcase section so I can flood you with some new Images and Videos
Posted: 25th Jul 2017 12:07
Cant wait for outline
Posted: 11th Aug 2017 13:10
Has Janbo or anyone released a fur shader?

I'd like to use it for a grass effect since i've decided to start coding again, and want to restart my VR Zelda game.
Posted: 11th Aug 2017 18:16
Yes I have
It's part of my App Shader Kit which is in progress and will hopefully be available as a Steam-DLC soon after the AGK's Virtual-Editor is released.
Posted: 2nd Sep 2017 4:48
While searching for some image processing shaders - came across this great set of photoshop style processing resources:

Levels, Gamma, HSL, Blending

+ Code Snippet
/*
** Copyright (c) 2012, Romain Dura romain@shazbits.com
** 
** Permission to use, copy, modify, and/or distribute this software for any 
** purpose with or without fee is hereby granted, provided that the above 
** copyright notice and this permission notice appear in all copies.
** 
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 
** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 
** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 
** SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
** WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
** ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 
** IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/*
** Photoshop & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate, levels control
**
** Romain Dura | Romz
** Blog: http://mouaif.wordpress.com
** Post: http://mouaif.wordpress.com/?p=94
*/



/*
** Desaturation
*/

vec4 Desaturate(vec3 color, float Desaturation)
{
	vec3 grayXfer = vec3(0.3, 0.59, 0.11);
	vec3 gray = vec3(dot(grayXfer, color));
	return vec4(mix(color, gray, Desaturation), 1.0);
}


/*
** Hue, saturation, luminance
*/

vec3 RGBToHSL(vec3 color)
{
	vec3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
	
	float fmin = min(min(color.r, color.g), color.b);    //Min. value of RGB
	float fmax = max(max(color.r, color.g), color.b);    //Max. value of RGB
	float delta = fmax - fmin;             //Delta RGB value

	hsl.z = (fmax + fmin) / 2.0; // Luminance

	if (delta == 0.0)		//This is a gray, no chroma...
	{
		hsl.x = 0.0;	// Hue
		hsl.y = 0.0;	// Saturation
	}
	else                                    //Chromatic data...
	{
		if (hsl.z < 0.5)
			hsl.y = delta / (fmax + fmin); // Saturation
		else
			hsl.y = delta / (2.0 - fmax - fmin); // Saturation
		
		float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
		float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
		float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;

		if (color.r == fmax )
			hsl.x = deltaB - deltaG; // Hue
		else if (color.g == fmax)
			hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
		else if (color.b == fmax)
			hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue

		if (hsl.x < 0.0)
			hsl.x += 1.0; // Hue
		else if (hsl.x > 1.0)
			hsl.x -= 1.0; // Hue
	}

	return hsl;
}

float HueToRGB(float f1, float f2, float hue)
{
	if (hue < 0.0)
		hue += 1.0;
	else if (hue > 1.0)
		hue -= 1.0;
	float res;
	if ((6.0 * hue) < 1.0)
		res = f1 + (f2 - f1) * 6.0 * hue;
	else if ((2.0 * hue) < 1.0)
		res = f2;
	else if ((3.0 * hue) < 2.0)
		res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
	else
		res = f1;
	return res;
}

vec3 HSLToRGB(vec3 hsl)
{
	vec3 rgb;
	
	if (hsl.y == 0.0)
		rgb = vec3(hsl.z); // Luminance
	else
	{
		float f2;
		
		if (hsl.z < 0.5)
			f2 = hsl.z * (1.0 + hsl.y);
		else
			f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
			
		float f1 = 2.0 * hsl.z - f2;
		
		rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
		rgb.g = HueToRGB(f1, f2, hsl.x);
		rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));
	}
	
	return rgb;
}


/*
** Contrast, saturation, brightness
** Code of this function is from TGM's shader pack
** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
*/

// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
vec3 ContrastSaturationBrightness(vec3 color, float brt, float sat, float con)
{
	// Increase or decrease theese values to adjust r, g and b color channels seperately
	const float AvgLumR = 0.5;
	const float AvgLumG = 0.5;
	const float AvgLumB = 0.5;
	
	const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
	
	vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);
	vec3 brtColor = color * brt;
	vec3 intensity = vec3(dot(brtColor, LumCoeff));
	vec3 satColor = mix(intensity, brtColor, sat);
	vec3 conColor = mix(AvgLumin, satColor, con);
	return conColor;
}


/*
** Float blending modes
** Adapted from here: http://www.nathanm.com/photoshop-blending-math/
** But I modified the HardMix (wrong condition), Overlay, SoftLight, ColorDodge, ColorBurn, VividLight, PinLight (inverted layers) ones to have correct results
*/

#define BlendLinearDodgef 			BlendAddf
#define BlendLinearBurnf 			BlendSubstractf
#define BlendAddf(base, blend) 		min(base + blend, 1.0)
#define BlendSubstractf(base, blend) 	max(base + blend - 1.0, 0.0)
#define BlendLightenf(base, blend) 		max(blend, base)
#define BlendDarkenf(base, blend) 		min(blend, base)
#define BlendLinearLightf(base, blend) 	(blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))
#define BlendScreenf(base, blend) 		(1.0 - ((1.0 - base) * (1.0 - blend)))
#define BlendOverlayf(base, blend) 	(base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
#define BlendSoftLightf(base, blend) 	((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
#define BlendColorDodgef(base, blend) 	((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
#define BlendColorBurnf(base, blend) 	((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
#define BlendVividLightf(base, blend) 	((blend < 0.5) ? BlendColorBurnf(base, (2.0 * blend)) : BlendColorDodgef(base, (2.0 * (blend - 0.5))))
#define BlendPinLightf(base, blend) 	((blend < 0.5) ? BlendDarkenf(base, (2.0 * blend)) : BlendLightenf(base, (2.0 *(blend - 0.5))))
#define BlendHardMixf(base, blend) 	((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
#define BlendReflectf(base, blend) 		((blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0))


/*
** Vector3 blending modes
*/

// Component wise blending
#define Blend(base, blend, funcf) 		vec3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))

#define BlendNormal(base, blend) 		(blend)
#define BlendLighten				BlendLightenf
#define BlendDarken				BlendDarkenf
#define BlendMultiply(base, blend) 		(base * blend)
#define BlendAverage(base, blend) 		((base + blend) / 2.0)
#define BlendAdd(base, blend) 		min(base + blend, vec3(1.0))
#define BlendSubstract(base, blend) 	max(base + blend - vec3(1.0), vec3(0.0))
#define BlendDifference(base, blend) 	abs(base - blend)
#define BlendNegation(base, blend) 	(vec3(1.0) - abs(vec3(1.0) - base - blend))
#define BlendExclusion(base, blend) 	(base + blend - 2.0 * base * blend)
#define BlendScreen(base, blend) 		Blend(base, blend, BlendScreenf)
#define BlendOverlay(base, blend) 		Blend(base, blend, BlendOverlayf)
#define BlendSoftLight(base, blend) 	Blend(base, blend, BlendSoftLightf)
#define BlendHardLight(base, blend) 	BlendOverlay(blend, base)
#define BlendColorDodge(base, blend) 	Blend(base, blend, BlendColorDodgef)
#define BlendColorBurn(base, blend) 	Blend(base, blend, BlendColorBurnf)
#define BlendLinearDodge			BlendAdd
#define BlendLinearBurn			BlendSubstract
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight(base, blend) 	Blend(base, blend, BlendLinearLightf)
#define BlendVividLight(base, blend) 	Blend(base, blend, BlendVividLightf)
#define BlendPinLight(base, blend) 		Blend(base, blend, BlendPinLightf)
#define BlendHardMix(base, blend) 		Blend(base, blend, BlendHardMixf)
#define BlendReflect(base, blend) 		Blend(base, blend, BlendReflectf)
#define BlendGlow(base, blend) 		BlendReflect(blend, base)
#define BlendPhoenix(base, blend) 		(min(base, blend) - max(base, blend) + vec3(1.0))
#define BlendOpacity(base, blend, F, O) 	(F(base, blend) * O + blend * (1.0 - O))


// Hue Blend mode creates the result color by combining the luminance and saturation of the base color with the hue of the blend color.
vec3 BlendHue(vec3 base, vec3 blend)
{
	vec3 baseHSL = RGBToHSL(base);
	return HSLToRGB(vec3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));
}

// Saturation Blend mode creates the result color by combining the luminance and hue of the base color with the saturation of the blend color.
vec3 BlendSaturation(vec3 base, vec3 blend)
{
	vec3 baseHSL = RGBToHSL(base);
	return HSLToRGB(vec3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));
}

// Color Mode keeps the brightness of the base color and applies both the hue and saturation of the blend color.
vec3 BlendColor(vec3 base, vec3 blend)
{
	vec3 blendHSL = RGBToHSL(blend);
	return HSLToRGB(vec3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
}

// Luminosity Blend mode creates the result color by combining the hue and saturation of the base color with the luminance of the blend color.
vec3 BlendLuminosity(vec3 base, vec3 blend)
{
	vec3 baseHSL = RGBToHSL(base);
	return HSLToRGB(vec3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));
}


/*
** Gamma correction
** Details: http://blog.mouaif.org/2009/01/22/photoshop-gamma-correction-shader/
*/

#define GammaCorrection(color, gamma)								pow(color, 1.0 / gamma)

/*
** Levels control (input (+gamma), output)
** Details: http://blog.mouaif.org/2009/01/28/levels-control-shader/
*/

#define LevelsControlInputRange(color, minInput, maxInput)				min(max(color - vec3(minInput), vec3(0.0)) / (vec3(maxInput) - vec3(minInput)), vec3(1.0))
#define LevelsControlInput(color, minInput, gamma, maxInput)				GammaCorrection(LevelsControlInputRange(color, minInput, maxInput), gamma)
#define LevelsControlOutputRange(color, minOutput, maxOutput) 			mix(vec3(minOutput), vec3(maxOutput), color)
#define LevelsControl(color, minInput, gamma, maxInput, minOutput, maxOutput) 	LevelsControlOutputRange(LevelsControlInput(color, minInput, gamma, maxInput), minOutput, maxOutput)
Posted: 17th Jan 2018 15:27
Post to unlock the thread.
Posted: 17th Jan 2018 15:43
Ha thanks Rick,
I post the shader though it is not too useful, but maybe I can encourage someone playing with shaders again.

I converted Game Of Life into shader code.
You could also convert the A* pathfinding algorithm into GLSL, but to make use of it you would need to read the pixel color via memblocks and thats what I call dirty coding ^^
Should be very fast still.
Image


Shader
+ Code Snippet
uniform sampler2D texture0;

varying vec2 uvVarying;

uniform vec2 agk_resolution;

int getPixel(int x, int y)
{
	if (texture2D(texture0, uvVarying + vec2(x, y)/agk_resolution.xy).r > 0.5)
		return 1;
	else
		return 0;
}

void main()
{
    int sum = getPixel(-1, -1) +
              getPixel(-1,  0) +
              getPixel(-1,  1) +
              getPixel( 0, -1) +
              getPixel( 0,  1) +
              getPixel( 1, -1) +
              getPixel( 1,  0) +
              getPixel( 1,  1);

	float current = float(getPixel(0, 0));
	 
	vec4 finalColor = vec4(0.0);
    if (sum == 3)
        finalColor = vec4(1.0);
	else if (sum == 2)
        finalColor = vec4(current, current, current, 1.0);
	else
        finalColor = vec4(0.0, 0.0, 0.0, 1.0);
	
	gl_FragColor = finalColor;
}

Demo
GameOfLife.zip
Posted: 16th Feb 2018 15:00
You could also convert the A* pathfinding algorithm into GLSL, but to make use of it you would need to read the pixel color via memblocks and thats what I call dirty coding ^^


2x2 pixels rgba image output = 4 * 4 bytes ; first frame render image stuff, next frame memblock readout stuff = realtime readout from shader up to 256 bytes
Combine it with float/ int to byte functions and a modular byte sequences in GLSL - Works and is perfect & ugly.
What else should we do in order to get massive real time math calculations?

Do the A* on GPU, this would be a total win for RTS.

Recently, I thought about an A* system for multiple units that share most of the path calculations, in order to boost some speed out of the calculations.
Also I wanted to split the world into nodes in order to find "track" bottlenecks, where a node connection will be made, in order to split the path finding problem into smaller, easier problems. (should also be done in real-time)

Funny though you mention the GPU A*, as I try to create more efficient, open RTS functions for T1 right now.
GPU A* is one of the biggest speed improvements beside the rendering passes in an RTS.

If it gets ridiculous fast with GPU A*, it allows awesome AI calculations.



Btw jambo, do you have a more efficient method for the fog of war?
I came up with a single render pass fog of war render.
It would be way faster, if the whole drawing occured in a shader.




Fog of War image rendering with only one renderpass:
+ Code Snippet
// Project: RTS new fow system 
// Created: 15.02.2018

/*

	Alex Schmidt,  online-arts.de

	Fog of War System that only uses one Render Image
	(Inb4 it used four render images...)
	
	The old system broke down during an update of AGK. Based on changes in the display aspect of render passes. 
	I took the chance to improve the performance, even if I fixed the old system...
	
	The new one works really well even with a 512x512 map. 
	It saves over 800 fps on my machine with syncrate = 0 and runs at about 2300fps
	This gives you the change to put more stuff in your game!
	
	Beware:
		Global DisplayX = 1024 
		Global DisplayY = 768
	
	are quite important, as the renderer changes the virtual resolution, you can replace the vars with your own
	
	
	
	Usage:
	
	You can create a Fog of War render pass like that:
	
		fowsys = CreateFogOfWarImageRender(512,512)

	And if you want to render an update, call:
	
		UpdateFogOfWarImageRender(fowsys)
		
	
	In between those commands, you update your unit positions and save their position in an array.
	Then you pass it to the Fog of war system:
	
		list as Vec3_2dUnit_def[0]
		list[0].px# = 100
		list[0].py# = 100
		list[0].size# = 32


		SetFogOfWarUnitDrawList( fowsys, list)
	
	this will be used, right before you call UpdateFogOfWarImageRender(fowsys)

	The list array can contain as much units as you need.
	To improve the render pass, try to remove the "tmp_fad" sprite and do a custom fade, without a helper sprite 
	

*/


// show all errors
SetErrorMode(2)
SetClearColor(0,0,0)


Global DisplayX = 1920
Global DisplayY = 1080

// set window properties
SetWindowTitle( "RTS new fow system" )
SetWindowSize( DisplayX, DisplayY, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( DisplayX, DisplayY ) // doesn't have to match the window
SetOrientationAllowed( 0, 0, 1, 0 ) // allow both portrait and landscape on mobile devices

SetSyncRate(60,1)
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

type Vec3_2dUnit_def
	px# as float
	py# as float
	size# as float
endtype


type FogOfWar_def
	RenderImg as integer
	tmp_spr_img as integer
	tmp_spr as integer
	tmp_buf as integer
	tmp_fad as integer
	BuffX as integer
	BuffY as integer
	UnitDrawList as Vec3_2dUnit_def[]
	
endtype


// create circle shader

file = OpenToWrite("circle.ps")
WriteLine(file,"varying mediump vec2 uvVarying;varying mediump vec4 colorVarying;void main(){float i = 0.0;if(length(uvVarying*2.0-1.0) < 1.0) i = 1.0;gl_FragColor = vec4(vec3(1.0),colorVarying.a*i)*colorVarying ;}")
CloseFile(file)




fowsys = CreateFogOfWarImageRender(512,512)


list as Vec3_2dUnit_def[32]
for i=0 to 32

	list[i].px# = random(0,512)
	list[i].py# = random(0,512)
	list[i].size# = random(0,64)
next i


list[0].px# = 100
list[0].py# = 100
list[0].size# = 32


SetFogOfWarUnitDrawList( fowsys, list)




// background
sprbg = CreateSprite(CreateImageColor(20,20,100,255))
SetSpriteSize(sprbg,DisplayX,DisplayY)

// display the render image
spr = CreateSprite(FogOfWar_System[fowsys].RenderImg)
SetSpritePosition(spr,100,100)
SetSpriteSize(spr,512,512)




do




	// update first unit in temporary list with new position information
	t#=t#+0.1
	px# = 256+sin(t#*20.0)*(256-32)
	py# = 256+cos(t#*20.0)*(256-32)

if GetRawMouseLeftState()
	px# = GetPointerX()-100
	py# = GetPointerY()-100
endif

	list[0].px# = px#
	list[0].py# = py#
	// SetSpriteVisible(tmp_blend,1)
	SetFogOfWarUnitDrawList( fowsys, list) // update list to Fog of War render data


	UpdateFogOfWarImageRender(fowsys) // render call for the fow system


    Print( ScreenFPS() )
    Sync()
loop




function SetFogOfWarUnitDrawList( pos, unitlist as Vec3_2dUnit_def[] )
	FogOfWar_System[pos].UnitDrawList = unitlist
endfunction


function UpdateFogOfWarImageRender(pos)

	BuffX = FogOfWar_System[pos].BuffX
	BuffY = FogOfWar_System[pos].BuffY
	
	tmp_fad = FogOfWar_System[pos].tmp_fad
	tmp_buf = FogOfWar_System[pos].tmp_buf
	tmp_spr = FogOfWar_System[pos].tmp_spr
	img = FogOfWar_System[pos].RenderImg
	
	SetSpriteVisible(tmp_fad,1)
	SetSpriteVisible(tmp_buf,1)
	SetSpriteVisible(tmp_spr,1)

	SetRenderToImage(img,-1)
	SetVirtualResolution( BuffX,BuffY )

	// SetSpriteImage(tmp_buf,img2)
	SetSpriteAdditionalImage(tmp_buf,img,1)

	SetSpriteShader(tmp_buf,0)
	SetSpriteColor(tmp_buf,255,255,255,1)
	SetSpritePosition(tmp_buf,0,0)
	SetSpriteSize(tmp_buf,BuffX,BuffY)
	SetSpriteTransparency(tmp_buf,1)
	DrawSprite(tmp_fad)
	DrawSprite(tmp_buf)


	// SetSpriteColor(tmp_spr,255,255,255,255)

	for drawcall = 0 to FogOfWar_System[pos].UnitDrawList.length // draws a circle representing each unit view

		size# = FogOfWar_System[pos].UnitDrawList[drawcall].size#
		px# = FogOfWar_System[pos].UnitDrawList[drawcall].px#
		py# = FogOfWar_System[pos].UnitDrawList[drawcall].py#
		SetSpriteSize(tmp_spr,size#,size#)
		SetSpritePosition(tmp_spr,px#-size#/2,py#-size#/2)
		DrawSprite(tmp_spr)

	next drawcall


	SetSpriteVisible(tmp_fad,0)
	SetSpriteVisible(tmp_buf,0)
	SetSpriteVisible(tmp_spr,0)
	
	SetVirtualResolution( DisplayX, DisplayY )
	SetRenderToScreen()
	
	
	
endfunction






function CreateFogOfWarImageRender(BuffX,BuffY)

	if FogOfWar_System.length = -1
		Dim FogOfWar_System[] as FogOfWar_def
	endif
	
	pos = FogOfWar_System.length + 1
	FogOfWar_System.length = pos
	
	circle = LoadSpriteShader("circle.ps")
	img = CreateRenderImage(BuffX,BuffY,0,1)

	tmp_spr_img = CreateImageColor(255,255,255,255)
	tmp_spr = CreateSprite(tmp_spr_img)
	tmp_buf = CreateSprite(CreateImageColor(0,0,0,255))
	tmp_fad = createsprite(tmp_spr_img)
	SetSpriteSize(tmp_buf,BuffX,BuffY)
	SetSpriteSize(tmp_fad,BuffX,BuffY)
	SetSpriteColor(tmp_fad,0,0,0,1)
	SetSpriteSize(tmp_spr,32,32)
	SetSpriteTransparency(tmp_spr,1)
	SetSpriteShader(tmp_spr,circle)

	FogOfWar_System[pos].BuffX = BuffX
	FogOfWar_System[pos].BuffY = BuffY
	FogOfWar_System[pos].RenderImg = img
	FogOfWar_System[pos].tmp_buf =tmp_buf
	FogOfWar_System[pos].tmp_fad = tmp_fad
	FogOfWar_System[pos].tmp_spr = tmp_spr
	FogOfWar_System[pos].tmp_spr_img = tmp_spr_img

endfunction pos




as EA dropped command and conquer, they opened the market for underdog RTS games.
Posted: 16th Feb 2018 19:48
You think "GPU A*" is a good thing, then we should try it.
While reading your comment I realized we don't need to read the full image via memblocks as we probably know where to start from and then we only process the neighbors of each pixel checking for the path's color.
We push this element onto a stack and then check the neighbors of the top element again. But this would only work for basic A*, not ?

janbo not jambo
I have no FogOfWar shader yet, but that might change soon
Posted: 16th Feb 2018 23:58
Let's get it done.

I played around with the idea to combine it with the advantanges of the Dijkstra?s algorithm.
https://www.youtube.com/watch?v=gdmfOwyQlcI
But still have no clue what and how to express.

Although I made some progress in the shader-output data part:

There are two ways we can go:

1. The output image of the pathfinding algorythm shader will transmit the valid path to AGK. It should be about 32x32 pixels in size, in order to contain a maximum of 1024 waypoints (although 16x16 with 256 waypoints should be enough in most cases)
The coordinates will be coded in a two byte package, in order to allow map sizes greater than 256 pixels.
This results in one pixel per waypoint:

RGBA Pixel:
Channel RG = X coordinate (0-65536) 2 bytes
Channel BA = Y coordinate (0-65536) 2 bytes

The first pixel should contain some header data in order to get the maximum amount of waypoints inside the output image. So there are 1023 waypoints in a 32x32 output image

The second method would be way harder to implement, but will result in way smaller output images:
2. It could already be enough to output only the move direction from the current position. So a 8 Way A* would only require 4 bits per waypoint.
This could result in a smaller output pass. We could code 2 waypoints into one byte. So we would transmit 8 waypoints per pixel.

I would prefer the first method. What do you think?

The interpretation of this data in AppGameKit is also easy, got some snippet somewhere on my other machine.

GLSL A* reference:
http://nullprogram.com/blog/2014/06/22/



The coco jambo sticks really well https://www.youtube.com/watch?v=m_-Qtz70_z4
Sorry, janbo
Posted: 17th Feb 2018 13:41
Hi

Do you know how I can just mix 2 textures (Or +) with an alpha channel for each texture ?
For example to create a grid shader with white line + red line for X and green line for y ?

thanks
Posted: 17th Feb 2018 20:04


"N" not "M"!!
Posted: 17th Feb 2018 21:28
lol !!!!!!
Posted: 18th Feb 2018 18:12
@Jack: Nice idea, i didn't thought about decoding it into a smaller texture.
There is a jambo in this forum actually

@Blendman: There is a comand for it mix hope that helps

@Bengismo: You made my day
Posted: 24th Feb 2018 6:24
Is there some progress in the A* shader? =) It would be awsome for RTS.

Right now I am working on a particle editor in order to improve the workflow for 3d particles.
Most 3d RTS games are based on 3d particles
So we do need a way to create them efficient.

It is also able to render scenes and import static objects. It should also be a great base for a model viewer.
Most of the stuff is already implemented, but the GUI controls are not complete.
Is there actually a community use for that kind of software?

Edit:
I also added a Geosphere Renderer. I will also work on a direct thumbnail creator:


It would be great if we could keep this running.



BTW, this is the .ps file for the 3d grid texture with shadows:

* Create a plane with the size 1x1
* scale the plane to your desired size, for example SetObjectScale(plane,16.0,1.0,16.0)
* Then give it just a SetObjectShaderConstantByName(plane, "Scale",16.0,16.0,0,0) with the scale size of your plane

+ Code Snippet

bool onGridline(int distFrom, int spacing);
bool onSplitline(int distFrom, int spacing, int interval);
varying highp vec2 iMouse;
varying mediump vec2 uvVarying;
uniform highp vec2 Scale;

uniform sampler2D texture0;
 
varying highp vec3 posVarying;
varying mediump vec3 normalVarying;

varying mediump vec3 lightVarying;
 
mediump vec3 GetPSLighting( mediump vec3 normal, highp vec3 pos );
mediump vec3 ApplyFog( mediump vec3 color, highp vec3 pointPos );
 



void main( )
{


    mediump vec3 norm = normalize(normalVarying);
    mediump vec3 light = lightVarying + GetPSLighting( norm, posVarying ); 
    
    mediump vec3 color = texture2D(texture0, uvVarying).rgb * light;
    color = ApplyFog( color, posVarying );
    
    gl_FragColor = vec4(color,1.0);

	// Colours , used to return to fragColor depending on criteria.
	const vec4 cBackground = vec4(0.0,0.0,0.0,0.0);			// Background colour.
	const vec4 cOrigin = vec4(0.0,0.392,0.392,1.0);			// Frag is directly in line with mouse's X or Y.
	const vec4 cLargeSplit = vec4(0.392,0.18,0.004,1.0);	// Frag is on a large split line.
	const vec4 cMedSplit = vec4(0.449,0.449,0.449,1.0);		// Frag is on a medium split line.
	const vec4 cGridline = vec4(0.293,0.293,0.293,1.0);		// Frag is on a grid line.
	
	// Grid lines
	const int spacingStd = 10;			// Spacing of normal grid lines
	const int intervalLargeSplit = 10;	// On how many gridlines a large split occurs.
	const int intervalMedSplit = 5;		// On how many gridlines a medium split occurs.
	const float zoom = 1.0;			// Zoom level of the grid.
	
	// Effective spacing
	// This is the standard grid spacing, as an integer, once zoom has been applied.
	// We do this here and use this value later to avoid float rounding errors.
	int effGrid = int(floor((float(spacingStd) * zoom) + 0.2));
	
	// Convenience integer values for resolution and frag position.
	int fragX = int((uvVarying.x-0.5)*Scale.x*10.0+(uvVarying.x-0.5));
	int fragY = int((uvVarying.y-0.5)*Scale.y*10.0+(uvVarying.y-0.5));

	
	// The offsets to the original mouse position were found by trial and error.
	int mouseX = int(iMouse.x);
	int mouseY = int(iMouse.y);
	
	// Distance this frag is from the mouse position, in each axis.
	int xDistFrom = int(abs(float(mouseX - fragX)));
	int yDistFrom = int(abs(float(mouseY - fragY)));
	
	// ============================================================
	
	// If on same X or Y as mouse, paint with origin colour.
	if ( fragX == mouseX || fragY == mouseY )
	{
		gl_FragColor = gl_FragColor*cOrigin;
		return;
	}
	
	// If on grid line, decide which colour to paint.
	else if ( onGridline(xDistFrom, effGrid) || onGridline(yDistFrom, effGrid) )
	{
		// If on large split line, choose this first.
		if ( onSplitline(xDistFrom, effGrid, intervalLargeSplit) ||
		     onSplitline(yDistFrom, effGrid, intervalLargeSplit))
		{
			gl_FragColor = gl_FragColor*cLargeSplit;
			return;
		}
		
		// Then check medium split line.
		else if ( onSplitline(xDistFrom, effGrid, intervalMedSplit) ||
		     onSplitline(yDistFrom, effGrid, intervalMedSplit))
		{
			gl_FragColor = gl_FragColor*cMedSplit;
			return;
		}
		
		// Otherwise, return normal grid line colour.
		else
		{
			gl_FragColor = gl_FragColor*cGridline;
			return;
		}
	}
	
	// Fragment is not in line with any grid line - paint as background.
	gl_FragColor = gl_FragColor*vec4(0.0, 0.0, 0.0, 0.0);
}


bool onGridline(int distFrom, int spacing)
{
	return mod(float(distFrom), float(spacing)) == 0.0;
}


bool onSplitline(int distFrom, int spacing, int interval)
{
	int newSpacing = spacing * interval;
	
	return mod(float(distFrom), float(newSpacing)) == 0.0;
}



You can use the default .vs shader for that


I also added the used Geosphere Skybox in the attachments, you're welcome.
Apply it as a texture to a sphere like that:
+ Code Snippet
       image = LoadImage("SkyHigh.jpg")
	Geosphere = CreateObjectSphere(100,100.0,100.0)
	SetObjectCullMode(Geosphere,2)
	SetObjectLightMode(Geosphere,0)
	SetObjectColor(Geosphere,0,0,0,255)
        SetobjectImage(Geosphere,image,0)


Boom, great sky....