Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Freakdesign

  1. Freakdesign

    modelling a Dodekaeder ?

    hi in my project i use huge 3d - constructs of spheres tiled in Quads i heard about Dodekaeder 3d-constructs and they match my goal a construct where all faces looks as the others actual i created a 64*64 mesh for each Quad of the sphere and thats the main problem... the spaces between points at the north/south pole are little, at equator the spaces are big if my objects are constructed as a Dodekaeder the spaces are all the same i need a formula which can create a spherevertexes like a dodekaeder or some good links to samples thx for help
  2. Hello ok heres my problem... i create a mesh from xfile... fine i place it in the world....fine i use Vertex/Pixelshader 3.0, but im very new to that :) it changes Lightning when scaled... scale bigger gets brighter scale smaller gets darker with FixedFunction Pipe i can use Renderstate.NormalizeNormals how can i use that in my shader? IMG static const int MAX_LIGHTS = 20; //-------------------------------------------------------------------------------------- // Variables from Outer Space //-------------------------------------------------------------------------------------- //Matrizen float4x4 eff_World : WORLD; // World float4x4 eff_VP : VIEWPROJECTION; // View + Projektion //Materials float4 eff_MaterialAmbient : MATERIALAMBIENT; // Material's ambient color float4 eff_MaterialDiffuse : MATERIALDIFFUSE; // Material's diffuse color //Light float4 eff_LightAmbient; // Ambient Light float4 eff_LightDiffuse[MAX_LIGHTS]; // Array of Light's diffuse color float4 eff_LightPosition[MAX_LIGHTS]; // Array Light's Position in world space //Texture bool eff_HasTexture; texture eff_Texture1; // Color texture for mesh int eff_NumberLights = 1; //-------------------------------------------------------------------------------------- // Texture samplers //-------------------------------------------------------------------------------------- sampler MeshTextureSampler = sampler_state { Texture = <eff_Texture1>; MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; }; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- struct VSTEXTURE_OUTPUT { float4 Position : POSITION; float4 Diffuse : COLOR; float2 TexCoord : TEXCOORD0; }; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- VSTEXTURE_OUTPUT VSTexture( float4 VertexPosition : POSITION, float3 VertexNormal : NORMAL, float2 VertexTexCoord : TEXCOORD0 ) { VSTEXTURE_OUTPUT Out; //----------------------------------------------------------------------------- //Calc VertexPosition + Normale //----------------------------------------------------------------------------- // position (view space) float4 tPositionWorldSpace = mul( VertexPosition, eff_World); // Normal (World) float3 tNormalWorldSpace = mul(VertexNormal, (float3x3)eff_World); //----------------------------------------------------------------------------- // scan Lights and calculate total Diffuse //----------------------------------------------------------------------------- float4 vTotalLightDiffuse = float4(0,0,0,0); float power =2; for(int i=0; i<eff_NumberLights; i++ ) { float3 tNormalLightDir = normalize(tPositionWorldSpace - eff_LightPosition[0]); float4 LightFact = max(0,dot( tNormalWorldSpace, -tNormalLightDir)); // Look here....Calculating Lightning // Baselight(Ambiente) + Ambiente * AmbLight + Diffuse * DiffLight // Thought it has to be: // Ambiente * AmbLight + Diffuse * DiffLight // but its soooo dark vTotalLightDiffuse.rgb += eff_LightAmbient * LightFact * power + eff_MaterialAmbient * eff_LightAmbient * LightFact*power + eff_MaterialDiffuse * eff_LightDiffuse * LightFact*power; } //----------------------------------------------------------------------------- // Output Section //----------------------------------------------------------------------------- // position transformed to View+Projecion Out.Position = mul(tPositionWorldSpace, eff_VP); Out.Diffuse.a = eff_MaterialDiffuse.a; Out.Diffuse.rgb = vTotalLightDiffuse; //----------------------------------------------------------------------------- // TextureCoords, only pass through //----------------------------------------------------------------------------- if ( eff_HasTexture ) { Out.TexCoord = VertexTexCoord; } else { Out.TexCoord =0; } return Out; } //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- // Pixel shader Input structure //-------------------------------------------------------------------------------------- struct PS_INPUT { float2 TextureUV : TEXCOORD0; float4 Diffuse : COLOR0; }; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- // Pixel shader output structure //-------------------------------------------------------------------------------------- struct PS_OUTPUT { float4 RGBColor : COLOR0; // Pixel color }; //-------------------------------------------------------------------------------------- //PIXEL SHADER //-------------------------------------------------------------------------------------- PS_OUTPUT RenderScenePS( PS_INPUT In) { PS_OUTPUT Output; // Lookup mesh texture and modulate it with diffuse if( eff_HasTexture ) { Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * In.Diffuse; } else { Output.RGBColor = In.Diffuse; } return Output; } //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- // Techniques //-------------------------------------------------------------------------------------- technique TSkinOnly { pass P0 { VertexShader = compile vs_3_0 VSTexture(); PixelShader = compile ps_3_0 RenderScenePS(); } } I'm sure it something very simple.... heeelp
  3. arrrg :) ok its late, too much coffee and too much other things i found it float3 tNormalWorldSpace = mul(VertexNormal, (float3x3)eff_World); changed to : float3 tNormalWorldSpace = normalize(mul(VertexNormal, (float3x3)eff_World)); and it works.. sometime its better to take a break..... i do so now.. Greets from Germany
  4. heyho i used the fixed function pipe in my actual project... all fine now i decided to implement VS + PS Shader and i get on a strange Problem: testing the shader on a tree looks like this: you see all is black. VS Shader is working.. i know it because i put a Vertexmovement into the treevertices an that black tree is animated. But where is the color??? here my .fx file for the shader float4x4 eff_World : WORLD; // World float4x4 eff_VP : VIEWPROJECTION; // View + Projektion float4x4 eff_View : VIEW; float4x4 eff_Projection : PROJECTION; float4 eff_MaterialAmbient: MATERIALAMBIENT; // Material's ambient color float4 eff_MaterialDiffuse: MATERIALDIFFUSE; // Material's diffuse color float4 eff_LightAmbient; // ARGB Light's diffuse color float4 eff_LightDiffuse[MAX_LIGHTS]; // Light's Position in world space float4 eff_LightPosition[MAX_LIGHTS]; float4 eff_LightDirection[MAX_LIGHTS]; float4 eff_LightAttenuation[MAX_LIGHTS]; float eff_LightRange[MAX_LIGHTS]; texture eff_Texture1; // Color texture for mesh float appTime; //for animate use int eff_NumberLights = 1; // Texture samplers sampler MeshTextureSampler = sampler_state { Texture = <eff_Texture1>; MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; }; // Vertex shader output structure //------------------------------------------------------------------------------ struct VS_OUTPUT { float4 Position : POSITION; // vertex position float2 TextureUV : TEXCOORD0; // vertex texture coords float4 Diffuse : COLOR0; // vertex diffuse color }; // This shader computes standard transform and lighting //------------------------------------------------------------------------------ VS_OUTPUT UNILightVS( float4 vPos : POSITION, float3 vNormal : NORMAL, float2 vTexCoord0 : TEXCOORD0, uniform int nNumLights, uniform bool bTexture, uniform bool bAnimate ) { VS_OUTPUT Output; float4 vAnimatedPos = vPos; float3 vNormalWorldSpace; //Animation the vertex based on time and the vertex's object space position if (bAnimate ) vAnimatedPos += float4(vNormal , 0) * (sin(appTime*3 +5.5)+0.5)*5; float4 tPositionWorldSpace = mul( vAnimatedPos, eff_World); // Transform the position from object space to homogeneous projection space Output.Position = mul(tPositionWorldSpace, eff_VP); // Transform the normal from object space to world space vNormalWorldSpace = normalize(mul(vNormal, (float3x3)eff_World)); // Compute simple directional lighting equation float3 vTotalLightDiffuse = float3(0,0,0); for(int i=0; i<nNumLights; i++ ) vTotalLightDiffuse += eff_LightDiffuse * max(0,dot(vNormalWorldSpace, eff_LightDirection)); Output.Diffuse.rgb = eff_MaterialDiffuse * vTotalLightDiffuse + eff_MaterialAmbient * eff_LightAmbient; Output.Diffuse.a = 1.0f; //tested this but no changes //Output.Diffuse.r = 1.0f; //Output.Diffuse.g = 1.0f; //Output.Diffuse.b = 1.0f; // Just copy the texture coordinate through if( bTexture ) Output.TextureUV = vTexCoord0; else Output.TextureUV = 0; return Output; } // Pixel shader output structure //------------------------------------------------------------------------------ struct PS_OUTPUT { float4 RGBColor : COLOR0; // Pixel color }; // This shader outputs the pixel's color by modulating the texture's // color with diffuse material color //------------------------------------------------------------------------------ PS_OUTPUT RenderScenePS( VS_OUTPUT In, uniform bool bTexture ) { PS_OUTPUT Output; // Lookup mesh texture and modulate it with diffuse if( bTexture ) Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * In.Diffuse; else Output.RGBColor = In.Diffuse; //tested this... it stays black //Output.RGBColor.a = 1.0f; //Output.RGBColor.r = 1.0f; //Output.RGBColor.g = 1.0f; //Output.RGBColor.b = 1.0f; return Output; } //------------------------------------------------------------------------------// Jo... //------------------------------------------------------------------------------ technique RenderSceneUNILight { pass P0 { //Arguments: 1 light , notexture, animated VertexShader = compile vs_1_1 UNILightVS(1, false, true); //Arguments: no texture PixelShader = compile ps_1_1 RenderScenePS(false); } } here the Methods for setup shader 'declare shadereffect Private i_Effect As Effect 'technique name declaration Private Const MyTechnik As String = "RenderSceneUNILight" 'other stuff '----------------------------- 'Creating the effect from file '----------------------------- Dim shaderFlags As ShaderFlags shaderFlags = shaderFlags.NoPreShader i_Effect = Me.CreateEffectFromFile( _ Par.Path_Shader + "\" + "StandardHLSL.fx", _ Nothing, Nothing,shaderFlags, Nothing ) 'other stuff '--------------------------- 'setting up Shader Variables 'all is capsuled by property, i posted only the "Set" code 'i changed the Variable names from "Value" to something more informational '--------------------------- i_Effect.SetValue(EffectHandle.FromString("eff_World"), pWeltMatrix) i_Effect.SetValue(EffectHandle.FromString("eff_VP"), Cam.ViewProjection) i_Effect.SetValue(EffectHandle.FromString("eff_LightRange"), Me.i_lightRange) i_Effect.SetValue(EffectHandle.FromString("eff_LightAttenuation"), Me.i_lightAttenuation) i_Effect.SetValue(EffectHandle.FromString("eff_LightPosition"), Me.i_lightPosition) i_Effect.SetValue(EffectHandle.FromString("eff_LightDirection"), Me.i_lightDirection) 'Light.DiffuseColor i_Effect.SetValue(EffectHandle.FromString("eff_LightDiffuse"), Me.i_lightDiffuse) 'Light.AmbientColor i_Effect.SetValue(EffectHandle.FromString("eff_LightAmbient"), me.i_LightAmbient) 'tmpMaterial.AmbientColor i_Effect.SetValue(EffectHandle.FromString("eff_MaterialAmbient"), ColorValue.FromColor(color.White)) 'tmpMaterial.DiffuseColor i_Effect.SetValue(EffectHandle.FromString("eff_MaterialDiffuse"), ColorValue.FromColor(color.White)) 'other stuff '------------------ 'Render '------------------ iter = pR.Eff.Begin(FX.None) '-->leads to "Return i_Effect.Begin(pFX)" For i = 0 To iter - 1 pR.Eff.BeginPass(i) '--> leads to "i_Effect.BeginPass(p)" Call RenderSubSet(AttribtID) pR.Eff.EndPass() '--->leads to "i_Effect.EndPass()" Next pR.Eff.Ende() '-->leads to "Call i_Effect.End()" My Problems are: 1. why i cant see any diffuse color on the object (notice that Vertexanimation works fine) 2. how can the object be black when i hardcode the output to Color White??? thx in advance [Edited by - Freakdesign on October 19, 2005 11:42:01 AM]
  5. Freakdesign

    Shader didnt work correctly, all is black

    yes i tried... Output.RGBColor.a = 1.0f; Output.RGBColor.r = 1.0f; Output.RGBColor.g = 1.0f; Output.RGBColor.b = 1.0f; return Output it stays black :(
  6. Oh great! i've tried your 3 alternative and it works perfektly. especialy your link to "love_your_z_buffer" link (funny name hehe) with the really helpful calculator helped a lot to bring more understanding into use of z-buffer and what values it use :))). My NearPlane now changes with Cam-Height above terrain and i got rid of these flicker fx. my Nearplane was static 1.0f, now my Nearplane varies from 1.0f (Cam near Ground) to something about 50 (Cam in high Orbit) it is as you said... it very effektiv. Special thanks again Jack, also greets from my friend called Fred, who started this little project with me in Sep2004 :) now i give my best to produce more little problems :)) FreakDesign ps: sorry for my bad english, its hard to explain problems in a foreign language... but it worked :)
  7. Hello world... in my actual project, a strategical Roleplaygame, i've now created the world and Characters. everything is fine but one thing is bad: I've created the terrain(64*32 tiles, each has 64*64 verts) by using a fractal and the water is a plane at height zero. This creates many verts and faces which are close to zero or maybe at zero. These (Terrain)faces gets in a Zbuffer-Fight with the waterplane when i move the Cam. The result is flickering faces. With Objects i have the same Problem, but Objects can be created without faces too near together..., the fractal terrain cant because its fractal How will Terrain always win the Zbuffer-Fight with the water? Or is there any technique to avoid flicker in case of near faces by giving some sort of priority?? What distance(Face to Face) is minimum distance at which directx dont get in problems? thanks for all help FreakDesign [Edited by - Freakdesign on February 14, 2005 4:17:26 PM]
  8. hi around... i'm actually at the point where i added multiple Lightning in my project and i read in the D3D SDK that a Software-Vertex-Processing-Device supports unlimited active Lights ! unlimited sounds like heaven for me because i need min. about 12 active lights. any other setting for the device (mixed-,hardware- and pure hardware processing) seams to be limited to the hardware caps of the GPU, in most cases 8 active lights. i tested it, but i get more then 50% loss of frames when using about 20-30 Lights( from 50frames(mixed VP, cutted Lights) to 22frames(software VP) ) my question: is there any chance to add (Software)Lights to the scene when i use Mixed Vertex Processing? i hope mixed means hard- and software benefits :), if i could use 8 hardware lights plus some software lights that would be best i think, if it is possible..., but i found no way to mix the lights... is there any Graphicadapter with more then 8 active lights supported by hardware? my ati radeon 9800 pro only has only 8 Lights supported by hardware thanks for answers... Frakdesign
  9. hi around... for my actual project, a roleplay game, my actual state is as follows: - 1 planet(64 Slices *32 Stacks, each with a 64*64 Grid), - 1st Light(general Ambient Light) - 2nd Light(sun, rays diffuse and Specular), - 3rd Light(Moon, rays low diffuse), - can place any x-file in world and move, scale, turn them - Clouds(sphere with texture) Lighting is managed as follows: Each Grid from Planet tests for his 4 Corners the 2 Lights(Sun/Moon) the angle to this Light, in case actual Light is from "Backface" it is gradually dimmed until complete disabled for entire Grid here a screenie, screenie2 now my Problem: i want to create "small" Lights, such as a fireplace or other small moveable Lights. i'm not sure how to make Lights, which are not real Lights from the Direct3D.Device. i heard the former actual generation of GraphicHardware has a maximum of Lightnumber of 8 Lights. Thats not enough for that what i plan... it has to be about 50-100 Lights i guess is there a good technique to simulate a light without using a "hardware" Light,which should i use? at the moment i plan to try rendering the scene as normal and then rendering with a "daylight" from CameraPosition into another Surface. For every "Fakelight" it would be calculated a small Transparent shere into screencoordinates, scaled relativly to distance, which i merge with the surface so that areas without such a sphere is blended totaly transparent. so i get a picture only with the "fakelight" radius. This i would lay "over" the normal rendered and bring it to front. As it is only theoretical at the moment it sounds usefull, but i have no experience with that stuff ^^ other alternative i thought is to take a 4th Light, which jumps at rendering time to each place when a item is rendered(must be in range of "small" Light), but this is difficult when there are 2 Lights near together, and 1 Grid is one Mesh so this would stay dark except 1 small light for such a huge area, but it would cast diffuse lightning, which looks good :) (probably i can add there until 4 Lights, but this doesnt helps when i need 5-20 lights) ok, hope for your tips or tutoriallinks :) FreakDesign
  10. ok, i did it half the way..... it was easier than expected :) Screenie1, Screenie2 what you think? looks pretty good for the prepreprealphaomega-Version hehe ok some little problems are left, like Lights that has range beyound the neighborgrid are cut there..., but that can be handled. so i think positiv and come up with a loud "SOLVED!" *ting* *opens a boddle* *cheers*
  11. Thanks for your post jollyjeffers. I'm glad to meet you (virtually) because i often read your Article you linked to. Good Work! I cant say i have understood it completly yet, but it gave me more clearness with shadows and how to understand stencils, zbuffer and other renderstuff :) You really greatly helped me with your hint, that i can have more than 8 Lights... hehe, i really thought i couldnt specify more than 8. Good to know that i can have a "big" Collection of Lights and have only 8(or until hardwarecap) enabled at the same time. At the moment i think i will follow that what u called "the easiest way" Quote:- the easiest is to employ some sort of algorithm that determines the 8 most relevent lights and enables only those. Some sort of heuristic based on "area of effect", brightness and/or colour are good. The Shadowvolume technique seems to be to slow for todays hardware when rendering more then 4 lights, that little scene runs with 15frames. I have really a great number of Meshes in Camview which have to calculated its Edges, but.. it looks very well. Probably i have to update my hardware (AMD2200+,1GB Ram, Geforce4Ti4400) or have to use vertexshaders, but thats may be beyound my personel capacity(because Assembler) btw: i'm coding with VB.Net, is it possible for managed VB Code to use HLSL/Vertexshader i will update here if i progress something :) FreakDesign
  12. Freakdesign

    DirectX 9 Lighting

    probably you forgot the Device.Lights(0).Update ? this hast to be done after every change to take effect and i dont found it in your snippet other thing is that i have to specify a Lightnumber(Device.Lights(0)) in my project as the Device.Lights is an array of the maximum Lights your Hardware provides hope this helps..
  13. Freakdesign

    Spherical Coords Math Problem

    hi all i have a problem with generating Texture Coordinates to a given sphere. there is a thread in Directx-Forum which discribes the problem... started this thread with hope some persons experienced in mathmatics could solve the problem LinkTo Gamedev-Directx Forum thanks and regards
  14. Hi all here i am with another Sphere-TextureMapping-Thread.... i searched in Gamedev Forums and googled it, found many and readed it all, but i cant figure out where is the mistake. here the problem: i have a sphere and a 2D-Texture. when i try to generate TextureCoords i only get "uncomplete" Mappings. a image says much more, so here's a screenshot: look here codesnippet for Mapping: '' loop through the vertices for i = 0 to Numverts - 1 'actual Vertice vertex = vb(i) dim v2 as new Vector2(vertex.Nx , vertex.Nz) call v2.Normalize '-------------------------------- ' calculate texture coordinates '-------------------------------- 'the "U" Coordinate if v2.Y > 0 then vb(i).Tu = (0.5 + math.Acos( v2.X ) / (2*math.PI)) else vb(i).Tu = (0.5 - math.Acos( v2.X ) / (2*math.PI)) end if 'the "V" Coordinate vb(i).Tv = (math.Asin(vb(i).Ny ) / math.PI+0.5 ) '-------------------------------- ' invert Normals to show it correct for looking from outside call vb(i).InvertNormals Next i tryed the Mappingformula from http://www.mvps.org/directx/articles/spheremap.htm but it appears mirrored and turned 90 degrees look: look here here's a snippet of my mapping code, where i tryed to use the Technique shown on this site: '' loop through the vertices for i = 0 to Numverts - 1 vert = vb(i) dim v2 as new Vector2(vert.Nx , vert.Nz) call v2.Normalize '' calculate texture coordinates vb(i).tu =((Math.Asin(v2.X)/math.PI)+0.5) vb(i).tv =((Math.Asin(v2.Y)/Math.PI)+0.5) ' invert Normals call vb(i).InvertNormals Next i want to have a mapping without artefacts, stretched in äquatorial area, compressed at north/south pole hope u can help me... i run out of energy thanks
  15. ok, i've attempted to take over the code of darookie (thnks for post btw) here is my coding and result: for i=0 to numverts-3 step 3 Dim fix as Boolean=False if not fix and (0.5 <= (math.Abs(vb(i).tu - vb(i+1).tu))) then fix = true end if if not fix and (0.5 <= (math.Abs(vb(i).tu - vb(i+2).tu))) then fix = true end if if not fix and (0.5 <= (math.Abs(vb(i+1).tu - vb(i+2).tu))) then fix = true end if if fix then if vb(i).tu < 0.5f then vb(i).tu += 1f end if if vb(i+1).tu < 0.5f then vb(i+1).tu += 1f end if if vb(i+2).tu < 0.5f then vb(i+2).tu +=1f end if end if next Screen looks somewhat shaked ^^, i hope i put your pseudocode correctly in my project... i tryed also to modify the calcs of the vb(i).Tv TexCoord to test the idea of _RMcl_, but i got bad results ok i found a big bug on other place.. always good i think :), but here im stucked on (this Shot (wireframe)) you can see that everything is fine but the last face. Solid here that one which uses 1 or 2 vertices of the starting verts. this face got completly bad Textureadresses(tu/tv). it seems to bee mirrored and flipped up/down and shows the whole texture (from 1,x to 0,x).. code for TextureCoords-generation: '' loop through the vertices for i = 0 to Numverts - 1 vert = vb(i) dim v2 as new Vector2(vert.NX , vert.NZ) v2.Normalize '' calculate texture coordinates from normals if v2.y > 0 then vb(i).Tu = 0.5 + math.Acos(v2.x) / (Math.PI*2) else vb(i).Tu = 0.5 - math.Acos(v2.x) / (Math.PI*2) end if vb(i).Tv = 0.5f + math.Asin( vb(i).Ny )/(math.PI) next as i know each vertice can only store one set of TextureCoords(tu/tv)... how can i tell a vertice to use Coords 0,0 (Starting face) _and_ use 1,0 in case of Faces that ends up with the same vertice??? uuhh... headaches... or... is it a good idea to modify all VertexRow-Positions at Createtime so that the "last row" can be nothing?? ok a bit loss from texture would survive.. hm... thank god, its christmas... best ideas coming when writing posts hehe, may be that works EDIT: How can i display Images direct in my Post? i only know the A HREF="url>"Text</A Command [Edited by - Freakdesign on December 22, 2004 3:30:22 PM]
  16. Hi all in my actual gameproject i stumbled in a strange Problem: say i create a mesh and render it without any modifications. I get what i exepected: my mesh with colors and textures and all material options (like transparency). now i scale this mesh bigger and bigger see what i get: Screenie you see the mesh darkens until it is black as the big black hole in the middle of the milkyway. where is the trick? why darkens my mesh, or is it a bug? ;) thx for any answer.... Freakdesign
  17. Freakdesign

    Mesh darkens when scaling bigger

    Great! it works perfectly. thats it! Thx for the fast help Aldenar. i setted it in the beginscene() - endscene() sequence. it seems to slow my engine a bit. is it performance expensive? i guess i need a table of all renderstates with their costs to speed ;)
  18. Greetings to all! For my actual project, which takes place on a "real" Planet, i stumbled in horrorble Navigation Problems. To avoid mindexplosion (i'm on it since 2 or 3 weeks) i hope i get a good push from you: As you see below the cam is looking north, driving forward will do what you expect... it drives to the Pole or away if backwards.. screenie1 but when i turn to look east and drive that Dir the cam moves to north too. This effect grows stronger when i move closer to NorthPole, at äquatorial line effect is almost gone: screenie2 i hope u understand what i mean (sorry for bad english) thx for any post in advance... FreakDesign edit: i forgot the position function, here it comes: (VB.net) 'POP = Position on Planet 'angH,angV = Horizontal/Vertical Longitude 'LocalDirection = ViewDirection me.PoP.newLocalPos( _ me.PoP.angH + (LocalDirection.X * speed), _ me.PoP.angV + (LocalDirection.Z * speed) _ ) i'm sure that the formula in this function is the point. i read many strange things about Loxodrom/Orthodroms and basicly this mathic Names have to do with my prob but i dont get it in my brain... as i can see it i currently steer with a loxodrom.. but i'm no good math-magician Greets FreakDesign [Edited by - Freakdesign on November 17, 2004 12:36:41 PM]
  19. Freakdesign

    HLSL with VB.Net?

    Hi around... Since i started my 3d project using VB.Net i really learnd much about Directx 9.0, and i got good results for a beginner i guess. now i'm able to create a landscape and objects in that and modify them in any Direction. Now i'm wondering about HLSL, i read everywhere that this is much more powerful than the fixed pipeline. All i see about it is written in C++, can it also be used in VB? if yes.... how would the small snippet below looks like? c++: float4x4 WorldviewProj; float4 Vertexshader_Name1(float inPos : POSITION) : POSITION { return mul(inPos, WorldViewProj); } vb: ?? Dim WorldViewProj as Matrix Public function Vertexshader_Name1(Vector4 inPos : POSITION) : POSITION as Vector4 return Mul(inPos,WorldViewProj) end function i have that snippet from a HowtolearnVertexShaderbook whats that Mul(), it seems VB.Net dont know it and is my translation in vb correct? thx for reading
  20. hi.. my actual Terrain is build up from an array of 32x32 vertices-meshes. i stumble about a strange effect as u can see here: u see the Edges of each mesh. lightning seems to computed different for one mesh to another. i could use bigger meshes, but it wont solve the probs on the edges what should i do to get it smooth? should i create a function which will check/set tilt and angles of faces in borderline to set them more plane? or exists a better way to do this? thx in advance [edit]May be this is because i dont added shadowing yet? it seems to be as when every mesh is lit as it is alone in space....
  21. Freakdesign

    Mesh render order problems

    Sort your Arraylist before call render, my sorting render routine: 'declare private Sorter as new Sorted_PhysicalItems ' ' ' public sub Render() if not VisibleMountains is nothing then 'sort... call VisibleMountains.Sort(sorter) dim l as Integer dim rm as CPhysItemMeshedMoveable for l=Visiblemountains.Count-1 to 0 step -1 rm=visibleMountains.Item(l) Call rM.Render(Device) Next end if end sub 'Sorterclass which will sort every thats inherits Sorted_PhysicalItems Public Class Sorted_PhysicalItems Implements System.Collections.IComparer Public Function Compare(ByVal left As Object, ByVal right As Object) As Integer Implements Collections.IComparer.Compare Dim l As PhysicalItem = CType(left, PhysicalItem) Dim r As PhysicalItem= CType(right, PhysicalItem) 'here im not sure about this sorting routine 'is sorted from globalviewdirection and item.X/Z-Pos Dim d1 As Single = l.position.X * GlobalViewDirection.X + l.position.Z * GlobalViewDirection.Z Dim d2 As Single = r.position.X * GlobalViewDirection.X + r.position.Z * GlobalViewDirection.Z If d1 = d2 Then Return 0 End If If d1 < d2 Then Return +1 End If Return -1 End Function End Class also set presentParams.AutoDepthStencilFormat = Direct3D.DepthFormat.D16 to presentParams.AutoDepthStencilFormat = Direct3D.DepthFormat.D24X8 for higher depth value hope it helps...
  22. Hi at all! my project is written in VB.Net and is a kind of Editor actually. i can place several objects in a landscape an modify them, but i dont know how to make "nice edges" look here: screenie1 screenie2 screenie3 the edges looks like stairs to the hell. more distance causes "hidden" Faces to "blink" i tryed to switch on the anti-aliasing feature from the driver-setup of my GraphicsHardware, but this causes the system to die a horroble death. i hope someone knows a tricky renderstate who deals with that aliasing of ObjectEdges, a technic to avoid this or just a helpful link this is my RenderStatesetup: Device.Lights(5).Type=LightType.Point Device.Lights(5).Enabled = True Device.Lights(5).Range = 10000000 Device.Lights(5).Position = TheSonnensystem.Jupiter.Position'.X + tgd.X * 400 device.Lights(5).Direction=new Vector3(0,0.1,0) Device.Lights(5).Attenuation0= 0.1 Device.Lights(5).Attenuation1= 0.000001 Device.Lights(5).Update() device.RenderState.Ambient = System.Drawing.Color.FromArgb(128,128,128) Device.SamplerState(0).MinFilter = TextureFilter.Linear Device.SamplerState(0).MagFilter = TextureFilter.Linear Device.SamplerState(0).MipFilter = TextureFilter.Linear Device.RenderState.CullMode = Cull.CounterClockwise Device.RenderState.Lighting = True Device.RenderState.ZBufferEnable = True Device.RenderState.ZBufferWriteEnable = True Device.RenderState.FillMode=FillMode.Solid Device.RenderState.ShadeMode=ShadeMode.Gouraud 'default Col.Ops und Col.Argues Device.TextureState(0).ColorOperation = TextureOperation.Modulate Device.TextureState(0).ColorArgument1 = TextureArgument.TextureColor Device.TextureState(0).ColorArgument2=TextureArgument.Diffuse thanks in advance... [Edited by - Freakdesign on October 25, 2004 7:58:06 AM]
  23. Freakdesign

    to much Stairs in Edges

    Thx to you PlayfulPuppy! it was the depthsetting of the BackbufferStencilFormat, with the following present.params it works really good(last was not set before so it takes Depth.Formar.D16 by default): presentParams.MultiSample=MultiSampleType.NonMaskable presentParams.MultiSampleQuality=2 presentParams.SwapEffect=SwapEffect.Discard presentParams.EnableAutoDepthStencil=true presentParams.AutoDepthStencilFormat = DepthFormat.D24X8 but my average fps goes down a bit (20%), is this a tribute to quality? greets --------
  24. Freakdesign

    how to make it transparent?

    Jaahooooo!!! Solved!!! Thanks to all who posted. for real transparency it is a MUST to declare: CustomVertex.TransformedColoredTextured.Format then.... the vertex color have to be white. other colors change the texturecolor. ALPHA value is for transparency: dim a as ColorValue = new ColorValue(255,255,255,200) dim col as Integer=a.ToArgb() Renderstates have to be: device.RenderState.SourceBlend=Blend.SourceAlpha device.RenderState.DestinationBlend=Blend.InvSourceAlpha device.RenderState.AlphaBlendEnable = True device.TextureState(0).AlphaOperation=TextureOperation.Modulate device.TextureState(0).AlphaArgument1=TextureArgument.TextureColor device.TextureState(0).AlphaArgument2=TextureArgument.Diffuse here is a screenie clickme dup di dudel dumm, dadel daaa dudidupidoo *happy hacking* PS: Gamedev is the only site i know where i really can get help Thx to the GameDev Masters
  25. in my project i cann see now landscape, objects and my menu. i have light and textures... i want to make my menu transparent to give it more quality... but i dont figured out how to.... here is the codesnippet of my rendering call: public overridable sub render(device as Direct3D.Device ) dim Mat as direct3d.Material '--------------------------------------------- mat.Ambient=color.White mat.Diffuse=color.White mat.Specular=color.White device.Material=mat device.RenderState.AlphaBlendEnable = True device.RenderState.SourceBlend = Blend.SourceAlpha device.RenderState.DestinationBlend = Blend.InvSourceAlpha device.SetStreamSource(0, myVertexBuf, 0) device.VertexFormat=CustomVertex.TransformedTextured.Format device.SetTexture(0, myTex) device.drawPrimitives(PrimitiveType.TriangleStrip, 0, 2) End Sub is it ok to define a material or is it of no need. how and where i can define a transparency level? with the sub like above it looks like this: screenie 130kb thx for all help
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!