Changeset 3188
- Timestamp:
- 11/27/08 00:22:23 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Standalone/EnvMap [DirectX]
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Standalone/EnvMap [DirectX]/EnvMap.cpp
r1672 r3188 297 297 case DIFFUSE_SPECULAR_LOCALIZED_5TEX: 298 298 V( g_pEffect->SetTechnique( "EnvMapDiffuseLocalized5Tex" ) ); 299 break; 300 case DIFFUSE_SPECULAR_LOCALIZED_ADAPT: 301 V( g_pEffect->SetTechnique( "EnvMapDiffuseAdapt" ) ); 302 break; 299 break; 303 300 } 304 301 -
GTP/trunk/App/Demos/Illum/Standalone/EnvMap [DirectX]/EnvMap.fx
r2482 r3188 293 293 294 294 float3 R = reflect(IN.View, IN.Normal); 295 //float3 R = refract(IN.View, IN.Normal, 1); 296 295 297 296 if (shininess <= 0) // diffuse 298 297 return intensity * readCubeMap(PreconvolvedEnvironmentMapSampler, IN.Normal) *2; … … 757 756 758 757 } 759 /* 760 float4 EnvMapDiffuseAdaptPS( _EnvMapVS_output IN ) : COLOR 761 { 762 float M = 4.0; 763 IN.View = -normalize( IN.View ); 764 IN.Normal = normalize( IN.Normal ); 765 IN.Position -= reference_pos.xyz; 766 float3 pos = IN.Position.xyz; 767 768 //return reference_pos; 769 //return readCubeMap(SmallEnvironmentMapSampler, pos); 770 771 float3 N =IN.Normal; 772 float3 R = -reflect( IN.View, IN.Normal ); 773 774 float4 I = 0; 775 float3 L1, L2, L3, L4, L; 776 float4 Le; 777 float Ld; 778 float width = 1.0 / M; 779 float width2 = width * 2; 780 float d; 781 782 for (float x = 0; x < M; x++) 783 for (float y = 0; y < M; y++) 784 { 785 float2 p, tpos; 786 tpos.x = x * width; 787 tpos.y = y * width; 788 789 p = tpos.xy; 790 p = 2.0 * p - 1.0; //-1..1 791 792 L = float3(p.x + width, p.y + width, 1); 793 Ld = readCubeMap(SmallEnvironmentMapSampler, L).a; 794 795 float dist = length(normalize(L) * Ld - pos); 796 if(dist < 1.0) 797 { 798 L1 = float3(p.x, p.y, 1); 799 L2 = float3(p.x + width2, p.y, 1); 800 L3 = float3(p.x + width2, p.y + width2, 1); 801 L4 = float3(p.x, p.y + width2, 1); 802 Le = float4(readCubeMap(SmallEnvironmentMapSampler, L).rgb, 1); 803 804 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 805 } 806 else 807 I += P2PContr(N, float3(0,0,-1), pos, L, SmallEnvironmentMapSampler); 808 809 } 810 811 for (float x = 0; x < M; x++) 812 for (float y = 0; y < M; y++) 813 { 814 float2 p, tpos; 815 tpos.x = x * width; // 0..1 816 tpos.y = y * width; // 0..1 817 818 p = tpos.xy; 819 p = 2.0 * p - 1.0; //-1..1 820 821 L = float3(p.x + width, p.y + width, -1); 822 Ld = readCubeMap(SmallEnvironmentMapSampler, L).a; 823 824 float dist = length(normalize(L) * Ld - pos); 825 if(dist < 1.0) 826 { 827 L4 = float3(p.x, p.y, -1); 828 L3 = float3(p.x + width2, p.y, -1); 829 L2 = float3(p.x + width2, p.y + width2, -1); 830 L1 = float3(p.x, p.y + width2, -1); 831 Le = float4(readCubeMap(SmallEnvironmentMapSampler, L).rgb, 1); 832 833 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 834 } 835 else 836 I += P2PContr(N, float3(0,0,1), pos, L, SmallEnvironmentMapSampler); 837 } 838 839 for (float x = 0; x < M; x++) 840 for (float y = 0; y < M; y++) 841 { 842 float2 p, tpos; 843 tpos.x = x * width; // 0..1 844 tpos.y = y * width; // 0..1 845 846 p = tpos.xy; 847 p = 2.0 * p - 1.0; //-1..1 848 849 L = float3(p.x + width, 1, p.y + width); 850 Ld = readCubeMap(SmallEnvironmentMapSampler, L).a; 851 852 float dist = length(normalize(L) * Ld - pos); 853 if(dist < 1.0) 854 { 855 L4 = float3(p.x, 1, p.y); 856 L3 = float3(p.x + width2, 1, p.y); 857 L2 = float3(p.x + width2, 1, p.y + width2); 858 L1 = float3(p.x, 1, p.y + width2); 859 Le = float4(readCubeMap(SmallEnvironmentMapSampler, L).rgb, 1); 860 861 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 862 } 863 else 864 I += P2PContr(N, float3(0,-1,0), pos, L, SmallEnvironmentMapSampler); 865 866 } 867 868 for (float x = 0; x < M; x++) 869 for (float y = 0; y < M; y++) 870 { 871 float2 p, tpos; 872 tpos.x = x * width; // 0..1 873 tpos.y = y * width; // 0..1 874 875 p = tpos.xy; 876 p = 2.0 * p - 1.0; //-1..1 877 878 L = float3(p.x + width, -1, p.y + width); 879 Ld = readCubeMap(SmallEnvironmentMapSampler, L).a; 880 881 float dist = length(normalize(L) * Ld - pos); 882 if(dist < 1.0) 883 { 884 L1 = float3(p.x, -1, p.y); 885 L2 = float3(p.x + width2, -1, p.y); 886 L3 = float3(p.x + width2, -1, p.y + width2); 887 L4 = float3(p.x, -1, p.y + width2); 888 Le = float4(readCubeMap(SmallEnvironmentMapSampler, L).rgb, 1); 889 890 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 891 } 892 else 893 I += P2PContr(N, float3(0,1,0), pos, L, SmallEnvironmentMapSampler); 894 895 } 896 897 for (float x = 0; x < M; x++) 898 for (float y = 0; y < M; y++) 899 { 900 float2 p, tpos; 901 tpos.x = x * width; // 0..1 902 tpos.y = y * width; // 0..1 903 904 p = tpos.xy; 905 p = 2.0 * p - 1.0; //-1..1 906 907 L = float3(1, p.x + width, p.y + width); 908 Ld = readCubeMap(SmallEnvironmentMapSampler, L).a; 909 float dist = length(normalize(L) * Ld - pos); 910 if(dist < 1.0) 911 { 912 L1 = float3(1, p.x, p.y); 913 L2 = float3(1, p.x + width2, p.y); 914 L3 = float3(1, p.x + width2, p.y + width2); 915 L4 = float3(1, p.x, p.y + width2); 916 Le = float4(readCubeMap(SmallEnvironmentMapSampler, L).rgb, 1); 917 918 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 919 } 920 else 921 I += P2PContr(N, float3(-1,0,0), pos, L, SmallEnvironmentMapSampler); 922 923 } 924 925 for (float x = 0; x < M; x++) 926 for (float y = 0; y < M; y++) 927 { 928 float2 p, tpos; 929 tpos.x = x * width; // 0..1 930 tpos.y = y * width; // 0..1 931 932 p = tpos.xy; 933 p = 2.0 * p - 1.0; //-1..1 934 935 L = float3(-1, p.x + width, p.y + width); 936 Ld = readCubeMap(SmallEnvironmentMapSampler, L).a; 937 float dist = length(normalize(L) * Ld - pos); 938 if(dist < 1.0) 939 { 940 L4 = float3(-1, p.x, p.y); 941 L3 = float3(-1, p.x + width2, p.y); 942 L2 = float3(-1, p.x + width2, p.y + width2); 943 L1 = float3(-1, p.x, p.y + width2); 944 Le = float4(readCubeMap(SmallEnvironmentMapSampler, L).rgb, 1); 945 946 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, SmallEnvironmentMapSampler); 947 948 } 949 else 950 I += P2PContr(N, float3(1,0,0), pos, L, SmallEnvironmentMapSampler); 951 } 952 return intensity * I; 953 }*/ 758 954 759 //-------------------------------------------------------------------------------------- 955 760 // Shading the environment … … 1047 852 TechniqueUsingCommonVS( EnvMapDiffuseLocalized8 ); 1048 853 TechniqueUsingCommonVS( EnvMapDiffuseLocalized16 ); 1049 1050 854 TechniqueUsingCommonVS( EnvMapDiffuseLocalizedNew ); 1051 855 TechniqueUsingCommonVS( EnvMapDiffuseP2P ); 1052 //TechniqueUsingCommonVS( EnvMapDiffuseAdapt );1053 856 1054 857 #define ReduceTextureTechnique(M); \ -
GTP/trunk/App/Demos/Illum/Standalone/EnvMap [DirectX]/Main.cpp
r1672 r3188 199 199 200 200 // SLIDERS 201 pp.Add( iWhichMethod, "WhichMethod [TAB,Q]", 5, VK_TAB, 'Q', noconvert, OnChangeCubeMap );201 pp.Add( iWhichMethod, "WhichMethod [TAB,Q]", 4, VK_TAB, 'Q', noconvert, OnChangeCubeMap ); 202 202 pp.Add( iWhichMesh, "WhichMesh [Home,End]", 9, VK_HOME, VK_END, noconvert, OnChangeMesh ); 203 203 pp.Add( fMeshScale, "Mesh size [Ins,Del]", 100, VK_DELETE, VK_INSERT, noconvert, OnChangeMeshSize ); … … 709 709 break; 710 710 case DIFFUSE_SPECULAR_LOCALIZED_NEW: 711 txtHelper.DrawFormattedTextLine( L"Method : Our method New (diffuse)");711 txtHelper.DrawFormattedTextLine( L"Method : Our method (diffuse), roboust form factor"); 712 712 break; 713 713 case DIFFUSE_SPECULAR_LOCALIZED_P2P: -
GTP/trunk/App/Demos/Illum/Standalone/EnvMap [DirectX]/Parameters.h
r1672 r3188 15 15 typedef enum { 16 16 DIFFUSE_SPECULAR_CLASSIC, ///< Classic environment mapping technique. 17 DIFFUSE_SPECULAR_LOCALIZED_P2P, ///< Point to point form factor 17 18 DIFFUSE_SPECULAR_LOCALIZED, ///< Our proposal. 18 19 DIFFUSE_SPECULAR_LOCALIZED_5TEX, ///< Our proposal, using 5 texel only. 19 DIFFUSE_SPECULAR_LOCALIZED_NEW, ///< Our proposal. 20 DIFFUSE_SPECULAR_LOCALIZED_P2P, ///< Point to point form factor 21 DIFFUSE_SPECULAR_LOCALIZED_ADAPT ///< Point to point form factor 20 DIFFUSE_SPECULAR_LOCALIZED_NEW ///< Our proposal with roboust form factor 21 22 22 } method_t; 23 23
Note: See TracChangeset
for help on using the changeset viewer.