Shaders’ Outpost
Moderators: winston, another_commander
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Shaders’ Outpost
Griff posted an example here related to discussion in the Progress thread. That discussion and the example have been joined together in a new topic.
E-mail: [email protected]
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Shaders’ Outpost
Interesting new rank you have there, Ahruman... may I have one, please? Something like Decidedly Dodgy Assassin, maybe?
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Shaders’ Outpost
I just moved an off-topic post out of here, you know, and it wasn’t even very off.
E-mail: [email protected]
Re: Shaders’ Outpost
Hi guys.
Query: How do I define galaxyNumber as a uniform bind in shipdata.plist shaders please?
uniforms =
{
uColorMap = { type = texture; value = 0; };
uNormalMap = { type = texture; value = 1; };
uEffectsMap = { type = texture; value = 2; };
uTime = "universalTime";
uGalaxy = "galaxy_number";
};
... is what I've got in the code but doesn't appear to be correct. Getting [shader.uniform.unpermittedMethod]: Did not bind uniform "uGalaxy" to property -[ShipEntity galaxy_number] - unpermitted method.
Query: How do I define galaxyNumber as a uniform bind in shipdata.plist shaders please?
uniforms =
{
uColorMap = { type = texture; value = 0; };
uNormalMap = { type = texture; value = 1; };
uEffectsMap = { type = texture; value = 2; };
uTime = "universalTime";
uGalaxy = "galaxy_number";
};
... is what I've got in the code but doesn't appear to be correct. Getting [shader.uniform.unpermittedMethod]: Did not bind uniform "uGalaxy" to property -[ShipEntity galaxy_number] - unpermitted method.
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Shaders’ Outpost
Looking at the rest of the syntax, have you tried "galaxyNumber" instead of "galaxy_number"?
Re: Shaders’ Outpost
Yep, had tried that previously with no luck also. According to the wiki ( http://wiki.alioth.net/index.php/Shader ... :_uniforms ) right down at the bottom "Additionally, all state query scripting methods ending with _number may be used for the player."
So maybe you can't bind it unless its a player object?
I'd like to be able to use it to offset a texture depending on which galaxy the player is in (the docking display screen in my beta TCA.oxp for additional broadcast arrays in other galaxy charts) rather than add like_ships for each chart relisting all the subentities from the template ship.
So maybe you can't bind it unless its a player object?
I'd like to be able to use it to offset a texture depending on which galaxy the player is in (the docking display screen in my beta TCA.oxp for additional broadcast arrays in other galaxy charts) rather than add like_ships for each chart relisting all the subentities from the template ship.
Re: Shaders’ Outpost
Looks like those are player only, yes. A slight hack: in their ship script, set their fuel levels to 0 -> 0.7 LY depending on galaxy, so the fuel uniform will then have the chart number from 0-7.Storm wrote:I'd like to be able to use it to offset a texture depending on which galaxy the player is in (the docking display screen in my beta TCA.oxp for additional broadcast arrays in other galaxy charts) rather than add like_ships for each chart relisting all the subentities from the template ship.
Re: Shaders’ Outpost
Thanks Cim, not got it working completely yet, but changing the fuel of the parent entity in the debug console changes the broadcast display on the fly now, so on the right track.
- submersible
- Commodore
- Posts: 264
- Joined: Thu Nov 10, 2011 7:49 am
Re: Shaders’ Outpost
Please forgive a possibly very novice question. I have been experimenting with shaders by modifying ahruman's cube_map test shaders to use cube maps for all cases. Currently parallax mapping has me a bit stumped. Picking the value for the parallax offset from a cube map was simple enough - however , perturbing the 'real' cube texture coordinates based on the parallax value and the position of the camera is _almost_ working. The effect I see appears correct for some 'faces' of the cube texture, but inverted on other faces.
Code: Select all
// Get texture coords, using parallax mapping if appropriate
//
// float parallax = texture2D(uNormalMap, vTexCoord).a;
float parallax = textureCube(uNormalMap, vCubeTexCoords).a ;
parallax *= 0.02;
vec3 ParallaxCubeTexCoords = vCubeTexCoords + parallax * vEyeVector;
Povray Planets - Planet textures for your galaxy
Re: Shaders’ Outpost
I'm having trouble with getting uGalaxy (an int, passed as Fuel in Shipdata which is working fine as non-player entities cannot pass galaxyNumber) used to multiply the offset Y-coordinate of a texture. People with older versions of OpenGL are getting error messages about trying to multiply an int with a float.
I'm currently trying to create a float offsetY variable as a float based on the value of uGalaxy and use that instead (relevant code pieces):
but I'm getting 'if' syntax errors for this. I'm pretty new to programming and so may have the format of the conditional statement wrong but googling so far has not turned up any fixes for me. Help would be appreciated!
I'm currently trying to create a float offsetY variable as a float based on the value of uGalaxy and use that instead (relevant code pieces):
Code: Select all
uniform int uGalaxy;
const float offsetY = 0.0;
#ifndef OO_REDUCED_COMPLEXITY
if(uGalaxy==1){offsetY=0.125;}
if(uGalaxy==2){offsetY=0.25;}
if(uGalaxy==3){offsetY=0.375;}
if(uGalaxy==4){offsetY=0.5;}
if(uGalaxy==5){offsetY=0.625;}
if(uGalaxy==6){offsetY=0.75;}
if(uGalaxy==7){offsetY=0.875;}
#endif
Re: Shaders’ Outpost
I think you should be able to do:
to convert the type, and go from there.
Code: Select all
uniform int uGalaxy;
float fGalaxy = float(uGalaxy);
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Shaders’ Outpost
That seems to do the trick for me. I have no errors in the log and see the Snoopers message.cim wrote:I think you should be able to do:to convert the type, and go from there.Code: Select all
uniform int uGalaxy; float fGalaxy = float(uGalaxy);
Re: Shaders’ Outpost
Thanks cim, knew that there was probably an easy way to do it
- Griff
- Oolite 2 Art Director
- Posts: 2483
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
Re: Shaders’ Outpost
From lusting after the lovely planet screenshots going up in the 'progress' thread i dug out the old Earth example shader (based on the example shader in ATI's Rendermonkey) and added in a small rim light atmosphere effect i pinched off a shader tutorial website
I couldn't find where the old oxp was stored so i've uploaded it again
https://www.box.com/s/8a7b8a4ba5cc6103366e
it just adds some big asteroids textured to look like Earth outside the station when the player launches so they'll be spinning around in all sorts of odd directions
I couldn't find where the old oxp was stored so i've uploaded it again
https://www.box.com/s/8a7b8a4ba5cc6103366e
it just adds some big asteroids textured to look like Earth outside the station when the player launches so they'll be spinning around in all sorts of odd directions
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Shaders’ Outpost
Rather good fun, blowing multiple mini-Earths to pieces. They do look nice, though!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!