### Welcome, Unregistered.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 30-Oct-2008, 08:18 #1 vrmm Junior Member   Join Date: Oct 2004 Posts: 25 can I bring the texture operation and fog ... into VS? Dear all, I want to get each vertex's color combing with the vertex color itself, the texture color, the fog color, the light color..... As we knew, in the PS, we just find the fragment. We can not tell which fragment is the source vertex of the model. So, One way for this problem is to distincting each vertex's and other interpolating pixels in the PS and get the final color of each vertex. But how to do it??? Another method maybe to bring all the texture operation and fog.. blending into the VS. Is it feasible? Could anyone help me to solve this porblem? Thanks a lot!!!
 31-Oct-2008, 10:33 #2 sebbbi Member   Join Date: Nov 2007 Posts: 996 Fog can be either calculated in vertex or pixel shader. Fog calculation in vertex shader: - In vertex shader calculate distance from vertex to camera point (length of the vertex position vector when transformed to view space). - Calculate fog amount according to distance (subtract fog start distance, divide result by fog length) - Pass this value to the pixel shader, and the HW raster conversion smoothly interpolates the fog value for the whole triangle area. - In pixel shader lerp the final color with the fog color (using fog amount) Fog calculation in pixel shader: - In vertex shader calculate distance from vertex to camera point (length of the vertex position vector when transformed to view space). - Pass this value to the pixel shader, and the HW raster conversion smoothly interpolates the fog value for the whole triangle area. - In pixel shader calculate fog amount according to distance (subtract fog start distance, divide result by fog length) - Lerp the final color with the fog color (using fog amount)
 02-Nov-2008, 06:15 #3 vrmm Junior Member   Join Date: Oct 2004 Posts: 25 Thanks your reply! The fog can be caluated in the VS. Unfortunately, to get the texture color of each vertex maybe not feasible. I have tried the "texture2D ()"" function in the vertex shader and it did not work actually. DO anyone have good idea about how to get the texture color in the VS ? I am eager to know the answer. Thanks in advance!
 03-Nov-2008, 12:05 #4 sebbbi Member   Join Date: Nov 2007 Posts: 996 Better to store the vertex colors inside the vertex structure if you want to achieve vertex coloring. Sampling textures inside the vertex shader is not that fast and has limited texture format support (on all DirectX 9 hardware).
 05-Nov-2008, 07:32 #5 vrmm Junior Member   Join Date: Oct 2004 Posts: 25 Thanks! I have tried the TEX2D() in the new machine with nvdia geforce 6.0 , fortuantely, it works. While I can get the vertex's texture color right now. However, I do not have idea to fetch it from VS and send to Opengl Application. Someone can give me good idea? THANKS!

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News Forums     Beyond3D News         Press Releases         Beyond3D Articles Core Forums     3D Architectures & Chips         3D Beginner's Questions     3D Technology & Algorithms         3D Programming & Tools     3D Hardware, Software & Output Devices         Video Technology, Displays, & HTPC     3D & Semiconductor Industry     GPGPU Technology & Programming Embedded 3D Forums     Console Forum         Console Technology         Console Games             PC Games     Handheld Gaming     Handheld Technology     CellPerformance@B3D PC Forums     Hardware & Software Talk         Politics & Ethics of Technology         Unix, Mac, & BSD (3D)     Processor & Chipset Technology     Purchase Decisions Help     PC Games         Console Games Site Forums     General Discussion     Folding For Beyond3D Team #32377     Industry Jobs     Site Feedback Beyond3D Hall of Fame     Pre-release GPU Speculation     General 3D Technology     Consoles     Other

All times are GMT +1. The time now is 11:45.

 -- vB3D -- vBulletin Default Style Contact Us - Beyond3D - Archive - Top