5 registered members (AndrewAMD, ozgur, Ayumi, 2 invisible),
690
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: What are you working on?
[Re: rvL_eXile]
#411766
11/19/12 16:32
11/19/12 16:32
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
I startet working on a small shader-pipeline editor. It is (or will be) a simple tool where I can create materials, render-targets etc. and link everything together by using an graphical interface and the program does the code part automatically in the background. EDIT: forgot the pic (._.') ![](http://img4.fotos-hochladen.net/uploads/shaderpipe4os3v0l7g5.png)
POTATO-MAN saves the day! - Random
|
|
|
Re: What are you working on?
[Re: Stansmedia]
#411794
11/19/12 22:04
11/19/12 22:04
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
![](/ubb7/images/groups/mod.gif)
X
|
![](/ubb7/images/groups/mod.gif)
X
Joined: Jul 2008
Posts: 2,107
Germany
|
@Stansmedia Thank you but i did not model it. U can get it from thegamecreators.com for a few bugs ![grin grin](/ubb7/images/graemlins/default_dark/grin.gif) greets @rvL_eXile When you're going to sell models ? ![grin grin](/ubb7/images/graemlins/default_dark/grin.gif) Edit: @Kartoffel Will u share your shader (creater) app ? Just read again: material creator...means no shader creator right ?
Last edited by rayp; 11/19/12 22:11.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: What are you working on?
[Re: rayp]
#411799
11/20/12 00:02
11/20/12 00:02
|
Joined: Feb 2005
Posts: 3,687 Hessen, Germany
Tempelbauer
Expert
|
Expert
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
|
Just found an old project directory on my hdd. There was a small 3DGS-App: The Mandelbrot sample ported to a postprocessing shader for navigating in realtime over the set. I created this long ago as I started to learn coding shaders: ![](http://i50.tinypic.com/35iu6gi.png) The code:
#include <acknex.h>
#include "PP_Helper.c"
float m_x = -2.7,
m_y = -1.5,
m_width = 4.0;
var fps=0;
var screenshotcounter=0, locked=0;
MATERIAL* mat =
{
effect="
float4 vecSkill1;
float4 vecViewPort;
float m_x_flt, m_y_flt, m_width_flt;
float4 JetColor(float v)
{
float d = 25.0;
v = v/d + 0.5;
int i = (int)v;
int f = (int)(255*(v-i));
int r=0, g=0, b=0;
switch(i){
case 0: r=0; g=0; b=f; break;
case 1: r=0; g=f; b=255; break;
case 2: r=f; g=255; b=255-f;break;
case 3: r=255; g=255-f;b=0; break;
case 4: r=255-f;g=0; b=0; break;
}
return float4(r/255.0,g/255.0,b/255.0,1.0);
}
float4 Shader(float2 tex : TEXCOORD0) : COLOR
{
float m_x = m_x_flt,
m_y = m_y_flt,
m_width = m_width_flt;
int w =0, h=0;
int i,j;
int times,inset;
float x,y,zx,zy,zxs,zys;
float4 Color = 0;
w = (int)vecViewPort.x;
h = (int)vecViewPort.y;
i=tex.x*w;
j=tex.y*h;
x = m_x+((float)i)*m_width/w;
y = m_y+((float)(h-j))*m_width/w;
zx = 0.0;
zy = 0.0;
inset = 1;
times = 0;
while(inset && times<130)
{
times++;
zxs = zx*zx;
zys = zy*zy;
zy = 2*zx*zy+y;
zx = zxs-zys+x;
if (zxs+zys >= 4.0) inset=0;
}
if(inset)
Color=0;
else
Color= JetColor(times);
return Color;
}
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_3_0 Shader();
}
}
";
}
PANEL* info =
{
digits(10,10,"FPS: %5.1f","Arial#18bi",16,fps);
digits(10,30,"[Esc] Exit","Arial#14",1,0);
digits(10,45,"[F1] 800x600 (Window)","Arial#14",1,0);
digits(10,60,"[F2] 1024x768 (Window)","Arial#14",1,0);
digits(10,75,"[F3] 1280x800 (Fullscreen)","Arial#14",1,0);
digits(10,90,"[F4] 1440x900 (Fullscreen)","Arial#14",1,0);
digits(10,105,"[F5] 1920x1080 (Fullscreen)","Arial#14",1,0);
digits(10,120,"[F6] Screenshot","Arial#14",1,0);
digits(10,135,"[F7] Back to Start","Arial#14",1,0);
flags = SHOW;
}
void exit_mandel()
{
sys_exit(NULL);
}
void keyaction(var taste)
{
if(taste==64 && !locked) //F6 - screenshot
{
locked=1;
BMAP* shot = bmap_createblack(screen_size.x,screen_size.y,24);
toggle(info,SHOW);
wait(1);
bmap_for_screen(shot,1,0);
wait(1);
toggle(info,SHOW);
bmap_save(shot,str_printf(NULL,"screenshot%d.png",(int)screenshotcounter));
screenshotcounter++;
locked=0;
return;
}
if(taste==65)
{
m_width = 4.0;
m_x = -2.7;
m_y = -1.5;
}
//change resolution
if(taste<59 || taste>63)
return;
int mode=7, screen=1;
switch(taste)
{
case 59:
screen=2;
break;
case 60:
mode=8;
screen=2;
break;
case 61:
mode=9;
break;
case 62:
mode=10;
break;
case 63:
mode=12;
break;
}
video_switch(mode,0,screen);
}
void main()
{
video_window(NULL,NULL,0,"MandelView V1.3");
level_load(NULL);
PP_Add(mat, camera, NULL);
mat.skill1=floatv(m_x);
mat.skill2=floatv(m_y);
mat.skill3=floatv(m_width);
on_esc = exit_mandel;
on_anykey = keyaction;
}
float saturate(float f)
{
if(f>0)
return 1.0;
if(f<0)
return -1.0;
return 0.0;
}
void zoom_startup()
{
while(1)
{
fps = 0.9*fps+0.1/time_frame;
if(mickey.x!=0||mickey.y!=0||mickey.z!=0 && !locked)
{
m_x += m_width*(float)mickey.x*(float)0.001;
m_y -= m_width*(float)mickey.y*(float)0.001;
m_width -= m_width*0.03*saturate(mickey.z);
}
wait(1);
}
}
YouŽll also need SlinŽs PP_Helper.c:
//////////////////////////////////////////////////
//////////Postprocessing Helperfunctions//////////
//////////////////////////////////////////////////
////08.03.2008////////////////by Nils Daumann/////
/////////////slindev.wordpress.com////////////////
//////////////////////////////////////////////////
//temporary pointers
VIEW* PP_Temp_View;
//Add an effect to a views stage chain
VIEW* PP_Add(MATERIAL* Material,VIEW* View,BMAP* bmap)
{
//find the last view of "View"s effectchain and store its pointer
PP_Temp_View = View;
while(PP_Temp_View.stage != NULL)
{
PP_Temp_View = PP_Temp_View.stage;
}
//create a new view as the stored views stage
PP_Temp_View.stage = view_create(0);
set(PP_Temp_View.stage,PROCESS_TARGET);
//assign "Material" to the just created view
PP_Temp_View = PP_Temp_View.stage;
PP_Temp_View.material = Material;
//if a bmap is given, render the view into it
if(bmap != NULL)
{
PP_Temp_View.bmap = bmap;
}
//return the pointer to the new view
return(PP_Temp_View);
}
//remove an effect from a views stage chain
int PP_Remove(MATERIAL* Material,VIEW* View,VIEW* StageView)
{
//find the view with the material selected or "StageView" and the previous view
PP_Temp_View = View;
while(PP_Temp_View.material != Material && ((StageView == NULL)+(PP_Temp_View.stage != NULL)) != 0)
{
View = PP_Temp_View;
PP_Temp_View = PP_Temp_View.stage;
//return one if the stage doesnŽt exist
if(PP_Temp_View == NULL){return(1);}
}
//pass the views stage to the previous view
View.stage = PP_Temp_View.stage;
//pass the render target
View.bmap = PP_Temp_View.bmap;
//reset the views bmap to null
PP_Temp_View.bmap = NULL;
//remove the view
ptr_remove(PP_Temp_View);
//return null if everything worked
return(0);
}
//remove all postprocessing from the view
void PP_Remove_All(VIEW* View)
{
if(View.stage == NULL){return;}
PP_Temp_View = View.stage;
View.stage = NULL;
View.bmap = NULL;
while(PP_Temp_View.stage != NULL)
{
View = PP_Temp_View;
PP_Temp_View = View.stage;
//pass the views stage to the previous view
View.stage = NULL;
//reset the views bmap to null
View.bmap = NULL;
//remove the view
ptr_remove(View);
}
}
//returns the pointer to the viewchains last view
VIEW* PP_LastView(VIEW* View)
{
//find the last view of "View"s effectchain and store its pointer
PP_Temp_View = View;
while(PP_Temp_View.stage != NULL)
{
PP_Temp_View = PP_Temp_View.stage;
}
//return the pointer
return(PP_Temp_View);
}
Of course, GameStudio Com or Pro is needed in order to run it. For the others I want to provide compiled binaries. Download
|
|
|
Re: What are you working on?
[Re: Harry Potter]
#411815
11/20/12 09:29
11/20/12 09:29
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
okay okay ![tongue tongue](/ubb7/images/graemlins/default_dark/tongue1.gif) Looks much better now. The next thing you could do: think about PhysX. ![wink wink](/ubb7/images/graemlins/default_dark/wink.gif) Not for those chains... We will use PhysX mainly as a better collision system than gamestudios OBB (PH_CHAR + ent_move works much better than c_move) But those chains are just a nice graphics prop and most time (i think) you can't even get to them, maybe 2, 3 times.
|
|
|
Re: What are you working on?
[Re: MasterQ32]
#411874
11/20/12 15:59
11/20/12 15:59
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Edit: @Kartoffel Will u share your shader (creater) app ? Just read again: material creator...means no shader creator right ? well I think I didn't describe it very well... sorry for that It should be a program which allows you to create materials / views / render-targets and set all the values (like material.ambient_red) with an graphical interface and link the views to a final shader pipeline; all this without having to deal with the code - the program does this in the background. This makes it possible that you only have to call one function (which got generated by the post-processing shader-pipeline editor) in the application you want to use it. Actually its main-purpose is to make it easier to connect pp shaders to a complicated shader-chain without having to care about the code-part. ...which means it is not a program to create 'click together shaders' - if you meant that. ( But that sounds like a good idea ![laugh laugh](/ubb7/images/graemlins/default_dark/laugh.gif) ) But at the moment I can't work on my projects very much because I've got a lot of other important stuff to do.
Last edited by Kartoffel; 11/20/12 16:09.
POTATO-MAN saves the day! - Random
|
|
|
Re: What are you working on?
[Re: Kartoffel]
#411980
11/21/12 16:37
11/21/12 16:37
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Created a triplanar-texturemapping shader. This technique doesn't require uv mapping and is geometry independent. It's like a 'fake 3D-texture' where the color of every pixle gets calculated by its position and normal. This allows you to texture spheres with (almost) perfect quality: ![](http://img3.fotos-hochladen.net/uploads/triplanartextujart9pewgl.png) It also is very useful for terrains to prevent texture streching at high angles.
POTATO-MAN saves the day! - Random
|
|
|
Re: What are you working on?
[Re: Kartoffel]
#411996
11/21/12 20:33
11/21/12 20:33
|
Joined: Jul 2001
Posts: 6,904
HeelX
Senior Expert
|
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
This looks cool! Are you willing to share the HLSL code? That would be AWESOME.
Last edited by HeelX; 11/21/12 20:34.
|
|
|
Re: What are you working on?
[Re: HeelX]
#411997
11/21/12 20:53
11/21/12 20:53
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Well, the idea behind it is pretty simple. The basic principle behind it is that on every axis the texture gets "projected" onto the surface and the higher the angle is the less alpha it has. (enable the line #define DebugProjections in the shader to see what I mean) Here's a small, commented example ( source code included, of course ![wink wink](/ubb7/images/graemlins/default_dark/wink.gif) ) EDIT: This technique is also often combined with multi-textures for each side (top, bottom, side): ![](http://img4.fotos-hochladen.net/uploads/terrainarchkwg83dq6f5.jpg)
Last edited by Kartoffel; 11/21/12 21:05.
POTATO-MAN saves the day! - Random
|
|
|
|