Jump to content

  • Log In with Google      Sign In   
  • Create Account

ali rahimi

Member Since 25 Sep 2006
Offline Last Active Oct 01 2013 10:18 PM

Topics I've Started

Custom tilling per each MipMap level.

02 October 2011 - 03:29 AM

Hello guys.
I want to use a Custom tilling per each MipMap level for landscape (Like lumion). If you notice in lumion landscape tilling change based on camera distance. Close distance have more tile's. One way is to do the tilling in photoshop per each mipmap, but problem is then you will have a low res tilling in close distance. (Cause it tiled in photoshop). Therefore iam trying to do the tilling in a shader itself. I setup an array of float2. X is tilling amount and Y is the mipmap count. But it don't work correct for some reason.
And i am using Quest3D for this.
int UseTangent : UseTangent; 
int UseBiNormal : UseBiNormal; 

float4x4 wvp : WorldViewProjection;
float4x4 worldI : WorldInverse;
float4x4 world : World;

texture Texture_Map : TEXTURE0
<
	string ResourceType = "2D";
>;
 
sampler2D Texture_MapSampler = sampler_state
{
	Texture = <Texture_Map>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = WRAP;
	AddressV = WRAP;
};

static float2 Tile_UV_Index[10] =
{	
	2,0,
	4,1,
	8,2,
	16,3,
	32,4,	
	64,5,
	128,6,
	256,7,
	512,8,
	1024,9,
};
 
//-------------------------------------------------------------------------------
// UV_Cordinate function
//-------------------------------------------------------------------------------
float4 UV_Cordinate (float3 VertexPosition)
{
	float4 UV_Cordinate_Result = float4(0,0,0,0);
	for(int i=0; i<10; i++)
{
	float2 UV_X = float2(VertexPosition.y, VertexPosition.z);
	float4 Output =  float4((UV_X/(Tile_UV_Index[i].x)).xy, 0, Tile_UV_Index[i].y);
    UV_Cordinate_Result += Output;
}
	return  UV_Cordinate_Result;
}
//-------------------------------------------------------------------------------
// input from application 
	struct a2v { 
	float4 position		: POSITION; 
	float2 texCoord		: TEXCOORD0; 

}; 

// output to fragment program 
struct v2f { 
        float4 position    		: POSITION; 
    	float2 texCoord			: TEXCOORD0; 
		float4 wposition    	: TEXCOORD2; 

}; 

// Ambient Pass Vertex Shader: 
v2f av(a2v In) 
{ 
	v2f Out = (v2f)0; 
	Out.position = mul(In.position, wvp);				//transform vert position to homogeneous clip space 
	Out.wposition = mul(In.position, world);				//world space vertex position passed out 
	Out.wposition.xyzw = Out.wposition.xzyw;		//Output vertex position in world space - swizzled for Y up 
	Out.wposition.y = -Out.wposition.y;
	Out.texCoord = In.texCoord;						//pass through texture coordinates from channel 1 

	return Out; 
} 

// Ambient Pass Pixel Shader: 
float4 af(v2f In) : COLOR 
{ 
	float3 VertexPosition = In.wposition.xyz;
	float2 UV_X = float2(VertexPosition.y, VertexPosition.z);
	

//	float4 Texture_Map =	tex2Dlod(Texture_MapSampler, float4((UV_X/1).xy, 0, 1)); // correct result, last float1 at the end is mipmap level.
	float4 Texture_Map =	tex2Dlod(Texture_MapSampler,float4(UV_Cordinate(VertexPosition))); // But function dont look correct.
	float3 input1 = Texture_Map.rgb; 

	float4 ret =  float4(input1, 1); 
	return ret; 
} 

technique Complete  
{  
	pass ambient  
    { 		
		VertexShader = compile vs_3_0 av(); 
		ZEnable = true; 
		ZWriteEnable = true; 
		CullMode = ccw; 
		ShadeMode = Gouraud;
		AlphaBlendEnable = false; 
		AlphaTestEnable = FALSE; 
		PixelShader = compile ps_3_0 af(); 
	}  

}    

Computing Light map for Radiosity Normal Mapping

19 September 2007 - 03:19 AM

Hello As you know Radiosity Normal Mapping is a method that have been used in Half-Life®2 / Valve Source™Shading http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf In a doc they say : In Radiosity Normal Mapping, we transform our basis into tangent space and compute light values for each vector. Therefore we will have 3 lightmap in tangent space. I just want to know how should i compute these 3 ligth map or better to say dose anyone know any render engine that do this task. Iam expert in mentalray but i dont see such an option in a bake section. Any help would be extremely useful. Thanks in advance.

X_FRIDGE

25 September 2006 - 09:05 PM

Hello To see the main page you can check this link http://www.ali-rahimi.net/projects/x_fridge/x_fridge.htm ------------------------------------------------------------------------- DISCRIPTION ----------------------------------------------------------------------------------------------------- X_FRIDGE is a realtime environmental visualization project with some parameters to change the overall view like the abiliity to add fog or change the camera FOV and also some post effects like Distortion, Bloom, Paint, etc that are applied in real time. Next all of them will be describe in detail. This is my first serious realtime project and my purpose was to get more familiar with realtime word and also get in professional to work with quest3d. Another purpose was to achive a higher level of realism.It was very challenging to me, because there are some limitations in the realtime content. And also it's not like software render. DEVELOPMENT PROCESS ----------------------------------------------------------------------------------------------------- Modeling and designing have been done in maya and the realtime frame work application has been Quest3d. For texturing I use a combination of maya and photoshop.To export a mesh in x format from maya to quest3d I used the okino polytransfer plugin. To generate a normal map I used NVIDIA Normal Map Filter Plugin. All the light bakeing processes are done by mental ray stand alone and there is no dynamic shadow or light in a final result. TECHNICAL DETAIL ----------------------------------------------------------------------------------------------------- SYSTEM REQUIREMENTS Microsoft Windows 98,ME,2000 or XP 3D accelerator card with minimum 16 bit color DirectX 9.0c or higher A latest of your GPU driver Here are the things I've implemented in the option menu DISPLAY ---------------------------------------------------------------------------------------- FILL MODES : Point - Wireframe - Solid SYSTEM INFO : On / Off COLISION OBJECTS VISIBILITY : Sky - Ground - Refrigerator OTHER EFFECTS : Distortion - Back light - Fridge Bloom - Overall Light Bloom Wet Ground : On / Off - Type : Reflection & Refraction / Reflection / Color only CLOUD SHADOW : On / Off - Shadow # 1 - Shadow # 2 - Shadow # 3 - Shadow # 4 -Shadow # 5 PERFORMANCE ---------------------------------------------------------------------------------------- PRESET QUALITY : Very Low - Low - Medium - High - Very High - Ultra High PARTICLE : On / Off OBJECTS VISIBILITY : Refrigerator - Atmosphere - Ground - Plants TEXTURE DETAIL : Very Low - Low - Medium - High - Vry High BUMP / NORMAL / RELIEF MAPPING : Disable All - Parallax Mapping - Relief Mapping - Relief Mapping Shadows NAVIGATION ---------------------------------------------------------------------------------------- CAMERA : Walkthrough - Object Inspection - Cinematic # 1 ... 8 CAMERA PROPERTY / Walkthrough : Focal Length - Gravity : On / Off - Reset Camera Position - Breathing Intensity CAMERA PROPERTY / Object Inspection : Focal Length - Damping Amount [ Zoom ] - Damping Amount [ Rotation ] CAMERA PROPERTY / Cinematic # 1 ... 8 : Focal Length DEPTH OF FIELD : On / Off - Strength - Quality : Low / Medium / High FOG : On / Off - Type : Lineair / Exponetial / Exponetial 2 - Start - End - Density - Color RGB POST EFFECTS ---------------------------------------------------------------------------------------- PAINTING / Option - BLACK & WHITE / Option - COLOR CORRECTION / Option - EDGE DETECT / Option - MEGA BLUR / Option - HEAVY BLUR - BLOOM / Option - NEGATIVE - TILES / Option - REDUCE COLORS / Option - SOFT BLUR / Option - TONING / Option - SOFTEN SOUND ---------------------------------------------------------------------------------------- MUSIC : On / Off - Volume AMBIANCE : On / Off - Volume INFORMATION ---------------------------------------------------------------------------------------- CREDITS : Developed by : Ali Rahimi Shahmirzadi - Music by : Homan Namdari CAPTURE / LAYER ---------------------------------------------------------------------------------------- CAPTURE PROPERTY : Capture speed - Capture Output Location - Capture With or Without GUI QUIT ---------------------------------------------------------------------------------------- Close the project KNOWN ISSUES ----------------------------------------------------------------------------------------------------- X_FRIDGE only tested on NVIDIA GPU there is a possiblity on ATI or other GPUs in Very High or Ultra High Preset Quality , ground texture become flicker. If it happens disable normal map or bump map. In case that you see any bug please report it to me with an snapshot of a problem. DOWNLOAD EXE / INSTALLER ----------------------------------------------------------------------------------------------------- System Requirements Microsoft Windows 98,ME,2000 or XP 3D accelerator card with minimum 16 bit color DirectX 9.0c or higher A latest of your GPU driver It's the main project file in EXE format. After installation it will run automaticly. To see the option menu when a project is running, press ESC key. Size : 152 MB http://www.ali-rahimi.net/projects/x_fridge/x_fridge.EXE DOWNLOAD MOVIE # 1 ----------------------------------------------------------------------------------------------------- This avi movie is in DivX 6.1 format. In case DivX 6.1video codec is not installed on your pc, you can download it from http://www.divx.com which is available free for mac and win. Note 1 : The fallowing movie is captuerd in real time directly from the project. Motion Blur, Camera Shake, Color Correction are added after capturing process in a composition software (fusion 5). Note 2 : It's recommended to watch this movie by DivX Player. HIGH QUALITY / 30.6 MB http://www.ali-rahimi.net/projects/x_fridge/X_FRIDGE_movie_1_high.avi MEDIUM QUALITY / 15.9 MB http://www.ali-rahimi.net/projects/x_fridge/X_FRIDGE_movie_1_medium.avi LOW QUALITY / 8.7 MB http://www.ali-rahimi.net/projects/x_fridge/X_FRIDGE_movie_1_low.avi DOWNLOAD MOVIE # 2 ----------------------------------------------------------------------------------------------------- This avi movie is in DivX 6.1 format. In case DivX 6.1video codec is not installed on your pc, you can download it from http://www.divx.com which is available free for mac and win. Note 1 : The fallowing movie is captuerd in real time directly from the project. Motion Blur is added after capturing process in a composition software (fusion 5). Note 2 : It's recommended to watch this movie by DivX Player. HIGH QUALITY / 283 MB http://www.ali-rahimi.net/projects/x_fridge/X_FRIDGE_movie_2_high.avi MEDIUM QUALITY / 115 MB http://www.ali-rahimi.net/projects/x_fridge/X_FRIDGE_movie_2_medium.avi LOW QUALITY / 77.7 MB http://www.ali-rahimi.net/projects/x_fridge/X_FRIDGE_movie_2_low.avi SNAPSHOT ----------------------------------------------------------------------------------------------------- All of this snapshots are taken directly from the project. http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_02.jpg http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_06.jpg http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_12.jpg http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_40.jpg http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_32.jpg http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_43.jpg http://www.ali-rahimi.net/projects/x_fridge/X_FRIDG_pic_57.jpg Waiting for your comment.

PARTNERS