Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Mar 2012
Offline Last Active May 29 2012 05:26 AM

Topics I've Started

How to add 2nd Texture only on shadow side of an object? (Earth w/ city lights)

04 May 2012 - 07:37 AM

Is there a way to add a texture to an object so that you can only see it on the shadow side of the object (some kind of inverse lightning)? I've got a sphere with a earth texture on it and a light (sun) rotating around the earth. The lighted side looks fine but the shadow side is just black (or gray shadowed depending on material settings). What i want is to add a 2. texture with earth at night (city lights and so on) which should only be visible on the shadow side and not on the daylight side. I've searched for hours and tried different lightning and blending options but nothing worked. The night texture is either visible everywhere or no where. Any suggestions how to solve this?
Thank you in advance!

p.s. I'm using DirectX9

Distorted Texture on Sphere

19 March 2012 - 05:49 AM

I was trying to add some Textures to a sphere created with Mesh.CreateSphere. As far as i know those spheres don't have texture coordinates so i tried to add them using the sample code provided here http://www.gamedev.n...ource-included/. I called the ComputeTexCoords method from the first post with the previously created mesh as argument and then set the texture with SetTexture in the render method (Mike's code in the second post throws for some reason out of bounds exceptions and I don't know why). When launching the program everything seems to be ok but when i rotate the sphere by 90° (no matter in which direction) the texture is highly distorted (like a vortex around the x-axis). The texture I was trying to use is this one: http://celestia.h-sc...nshaded1024.jpg. If it's helpful i'll post a screenshot of the distorted texture on the sphere later (it's on another computer).
Can someone tell me what I'm doing wrong? Is it something with the ComputeTexCoords method or with the Texture? Do I have to change some RenderState/SamplerState settings?
Thank you in advance.

p.s.: I'm using Direct3D9 with SlimDX and Visual Studio 2008 (C#)