Jump to content

  • Log In with Google      Sign In   
  • Create Account

progman_rus

Member Since 25 Dec 2008
Offline Last Active Private

Posts I've Made

In Topic: DirectShow doesnd play mp4 movie

19 September 2011 - 10:54 PM

GraphEdit show 80004500 error too
but all videoplayers ( MPC, KMPlayer, Windows Media Center ) play mp4 files ok

In Topic: DirectShow doesnd play mp4 movie

19 September 2011 - 10:39 PM

In your code snippit you only test against S_OK.

There are many possible error results, E_FAIL is not listed among them.

Which one is your real error code?


I have 0x80004005 it is E_FAIL name from erors table: http://msdn.microsoft.com/en-us/library/dd390090(VS.85).aspx

S_OK Success.
VFW_S_AUDIO_NOT_RENDERED Partial success; the audio was not rendered.
VFW_S_DUPLICATE_NAME Success; the Filter Graph Manager modified the filter name to avoid duplication.
VFW_S_PARTIAL_RENDER Some of the streams in this movie are in an unsupported format.
VFW_S_VIDEO_NOT_RENDERED Partial success; some of the streams in this movie are in an unsupported format.
E_ABORT Operation aborted.
E_FAIL Failure.
E_INVALIDARG Argument is invalid.
E_OUTOFMEMORY Insufficient memory.
E_POINTER NULL pointer argument.
VFW_E_CANNOT_CONNECT No combination of intermediate filters could be found to make the connection.
VFW_E_CANNOT_LOAD_SOURCE_FILTER The source filter for this file could not be loaded.
VFW_E_CANNOT_RENDER No combination of filters could be found to render the stream.
VFW_E_INVALID_FILE_FORMAT The file format is invalid.
VFW_E_NOT_FOUND An object or name was not found.
VFW_E_UNKNOWN_FILE_TYPE The media type of this file is not recognized.
VFW_E_UNSUPPORTED_STREAM Cannot play back the file: the format is not supported.


In Topic: I try to found ths thre:

26 July 2011 - 11:04 AM

Posted ImagePosted ImagePosted Image
this three tree from my HDD ( i have about 40 sprites with shadow ) but small size only
I do not remember where i got it.

second sprite i found with google.

I think that first was got from tree pack.
I want to find it

In Topic: Best way to render Earth's day and night

03 July 2011 - 12:22 AM

Ah, ok, If you don't want anything fancy then I suggest taking a page from a guy that I will link below. If you want to keep it simple then this is probably the way to go, If you have any questions regarding his approach I'm sure he won't mind you asking him. I provided you with two links, depending on the complexity you want. If you want anything more realistic/appealling than that (taking into account that your atmosphere will most likely be very thin compared to his), then you will have to implement considerably harder code, with the added computation cost that comes with that. Hope that helped.

http://petrocket.blo...re-shaders.html
http://petrocket.blo...-treegrass.html


looks great
I was unable to translate that shader from HLSL to GLSL :(


this is my vertex shader
attribute vec4 vPosition;
attribute vec4	vColor;
attribute vec2	uv;

uniform vec3 lightVector;//already normalize
uniform vec3 camPos;
uniform vec3 lightPos;

uniform float SurfaceRadius;
uniform float AtmosphereRadius;
uniform float StretchAmt;

varying vec4 vVertexColor;
varying vec2 myTexCoord;

varying vec3 oLightDir;
varying vec3 oCamToPos;
varying vec2 oUV;
varying float oAlpha;

void main( void )
{
	gl_Position		= gl_ModelViewProjectionMatrix  * vPosition;
   	
	vec3 position	= vPosition.xyz;
	
	float radius		= length(position);
	float radius2		= radius * radius;
	float camHeight		= length(camPos.xyz);
	vec3 camToPos		= position - camPos.xyz;
	float farDist		= length(camToPos);

	vec3 lightDir		= normalize( lightVector.xyz );
	vec3 normal			= normalize( position );

	vec3 rayDir			= camToPos / farDist;
	float camHeight2	= camHeight * camHeight;

	float B				= 2.0 * dot(camPos.xyz, rayDir);
	float C				= camHeight2 - radius2;
	float det			= max(0.0, B*B - 4.0 * C);
	float nearDist		= 0.5 * (-B - sqrt(det));
	vec3 nearPos		= camPos.xyz + ( rayDir * nearDist );
	vec3 nearNormal		= normalize( nearPos );
	
	
	// get dot products we need
	float lc			= dot( lightDir, camPos / camHeight );
	float ln			= dot( lightDir, normal );
	float lnn			= dot( lightDir, nearNormal );
	
	// get distance to surface horizon
	float altitude		= camHeight - SurfaceRadius;
	float horizonDist	= sqrt((altitude*altitude) + (2.0 * SurfaceRadius * altitude));
	float maxDot		= horizonDist / camHeight;
  
	// get distance to atmosphere horizon - use max(0,...) because we can go into the atmosphere
	altitude			= max( 0.0, camHeight - AtmosphereRadius);
	horizonDist			= sqrt((altitude*altitude) + (2.0 * AtmosphereRadius * altitude));
	
	// without this, the shift between inside and outside atmosphere is  jarring
	float tweakAmount = 0.1;
	float minDot		= max(tweakAmount,horizonDist / camHeight);
  
	// scale minDot from 0 to -1 as we enter the atmosphere
	float minDot2		= ((camHeight - SurfaceRadius) * (1.0 / (AtmosphereRadius  - SurfaceRadius))) - (1.0 - tweakAmount);
	minDot = min(minDot, minDot2);
   
	// get dot product of the vertex we're looking out
	float posDot		= dot(camToPos / farDist,-camPos.xyz / camHeight) - minDot;
  
	// calculate the height from surface in range 0..1
	float height		= posDot * (1.0 / (maxDot - minDot));
  
	// push the horizon back based on artistic taste
	ln					= max( 0.0 ,ln + StretchAmt);
	lnn					= max( 0.0 ,lnn + StretchAmt);
 
	// the front color is the sum of the near and far normals
	float brightness	= clamp(ln + (lnn * lc), 0.0, 1.0 );
  
	// use "saturate(lc + 1.0 + StretchAmt)" to make more of the sunset side color be used when behind the planet
	oUV.x				= brightness * clamp(lc + 1.0 + StretchAmt, 0.0, 1.0 );
	oUV.y				= height;
  
	height				-= min( 0.0, minDot2 + (ln * minDot2) );
	oAlpha				= height * brightness;
  
	// normalised camera to position ray
	oCamToPos			= -rayDir;
	oLightDir			= normalize( lightPos.xyz - position.xyz ); 
}

and this is pixel
uniform sampler2D gTexSampler;

varying vec2	oUV;
varying float	oAlpha;
varying vec3	oCamToPos;
varying vec3	oLightDir;
	
void main( void )
{
  const float fExposure	= 1.5;
	float Atmosphere_G		= -0.95;
	float g					= Atmosphere_G;
	float g2				= g * g;
 
	// atmosphere color
	vec4 diffuse			= texture2D( gTexSampler, oUV );
	vec4 diffuse2			= texture2D( gTexSampler, vec2( min( 0.5, oUV.x ), 1 ) );
 
	float fCos				= dot( normalize( oLightDir.xyz ), normalize( oCamToPos ) );
	float fCos2				= fCos * fCos;
 
	vec4 diffuseColor		= diffuse * oAlpha;
 	
	// sun glow color
	float fMiePhase			= 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) /(1.0 + g2 - 2.0*g*fCos);
	vec4 mieColor			= diffuse2 * fMiePhase * oAlpha;
   
	gl_FragColor			= 1.0 - exp( -fExposure * ( diffuseColor * (1.0 + oUV.y) + mieColor ) );
}

shader draws trash :(

In Topic: Best way to render Earth's day and night

02 July 2011 - 10:05 AM

Could you tell me what you're trying to achieve here? Do you just want Earth with some sort of atmospheric scattering? I'm working on a planet renderer and I can probably point you in the right direction based on what you want to do.

I try to do space-view to Earth for my game.
I want that looks like google earth.
Must be very fast and very easy - becouse will port to android and OpenGl ES

now i improve as ginkgo explained. will better:
Posted Image

and very easy shader for terminator and shadow
void main( void )
{
vec4 texel0, texel1, resultColor;
		
	float alpha		= clamp( 8.0 * max( 0.0, dot( light_dir,  normal ) ), 0.0, 1.0 );	
	
	texel0			= texture2D( sampler2d, myTexCoord );
	texel1			= texture2D( nightTexture, myTexCoord );
		
	resultColor		= mix( texel0, texel1,  alpha );
	gl_FragColor	= resultColor;
}

will to do glow around Earth looks like google earth.

PARTNERS