- Mesh smoothing:
- local averaging
- minimize local gradient energy in 3 dimensions
- Fourier transform (low pass filter) similar to local averaging idea
- image convolution
- F(A*B) = F(A) * F(B)
- Spectral Analysis
- In general: extending eigenvalues, eigenvectors to linear operators on (continuous) functions.
- Fourior transform:
- approximate signal as weighted sum (linear combination) of sines and cosines of different frequencies.
- change of basis using eigenfunctions of Laplace operator (complex exponentials including sines and cosines)
- Fourier transform function:
- spacial domain–>frequency domain F(epsilon) complex amplitude
- Inverse transform:
- denoising: fourier transform–>filter out high frequency–>fourior inverse transform
- For mesh:
- Intuition: Fourior transform by projecting onto eigenfunctions of Laplacian
- mesh laplacian L is n x n matrix, n is number of vertices
- Use PSD L (not normalized by vertex valence of voronoi area)
- eigenvectors orthogonal
- Project geometry onto eigenvectors.
- reconstruction from eigenvectors associated with low frequencies
- Chanllenge:
- Too complex!
- Too much computation!
- Diffusion
- Laplace smoothing
- Laplace is second derivative.
- Smooth with Gaussian kernel.
- backward Euler
- solve p’ = p + mu * dt *L * p’
- (I – mu * dt * L) p’ = p, identity matrix I
- solve linear system for p’ in each step
- Advantages: Allow larger time steps, no numerical stability problems.
- Laplace smoothing
- Energy minimization
- Alternatives
Falcor Material and Light Load
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
bool SceneRenderer::setPerMaterialData(const CurrentWorkingData& currentData, const Material* pMaterial) { ConstantBuffer* pCB = currentData.pVars->getConstantBuffer(kPerMaterialCbName).get(); if (pCB) { pMaterial->setIntoProgramVars(currentData.pVars, pCB, "gMaterial"); } return true; } void SceneRenderer::updateVariableOffsets(const ProgramReflection* pReflector) { if (sWorldMatOffset == ConstantBuffer::kInvalidOffset) { const auto pPerMeshCbData = pReflector->getBufferDesc(kPerMeshCbName, ProgramReflection::BufferReflection::Type::Constant); if (pPerMeshCbData != nullptr) { assert(pPerMeshCbData->getVariableData("gWorldMat[0]")->isRowMajor == false); // We copy into CBs as column-major assert(pPerMeshCbData->getVariableData("gWorldInvTransposeMat[0]")->isRowMajor == false); assert(pPerMeshCbData->getVariableData("gWorldMat")->arraySize == pPerMeshCbData->getVariableData("gWorldInvTransposeMat")->arraySize); sWorldMatArraySize = pPerMeshCbData->getVariableData("gWorldMat")->arraySize; sWorldMatOffset = pPerMeshCbData->getVariableData("gWorldMat[0]")->location; sWorldInvTransposeMatOffset = pPerMeshCbData->getVariableData("gWorldInvTransposeMat[0]")->location; sMeshIdOffset = pPerMeshCbData->getVariableData("gMeshId")->location; sDrawIDOffset = pPerMeshCbData->getVariableData("gDrawId[0]")->location; } } if (sCameraDataOffset == ConstantBuffer::kInvalidOffset) { const auto pPerFrameCbData = pReflector->getBufferDesc(kPerFrameCbName, ProgramReflection::BufferReflection::Type::Constant); if (pPerFrameCbData != nullptr) { sCameraDataOffset = pPerFrameCbData->getVariableData("gCam.viewMat")->location; const auto& pCountOffset = pPerFrameCbData->getVariableData("gLightsCount"); sLightCountOffset = pCountOffset ? pCountOffset->location : ConstantBuffer::kInvalidOffset; const auto& pLightOffset = pPerFrameCbData->getVariableData("gLights[0].worldPos"); sLightArrayOffset = pLightOffset ? pLightOffset->location : ConstantBuffer::kInvalidOffset; const auto& pAmbientOffset = pPerFrameCbData->getVariableData("gAmbientLighting"); sAmbientLightOffset = pAmbientOffset ? pAmbientOffset->location : ConstantBuffer::kInvalidOffset; } } } |
D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT = 8
740 Oct26
How to solve Linear list square min||Ax – b||^2??
https://en.wikipedia.org/wiki/Linear_least_squares_(mathematics)
How to find the transformation matrix if we don’t have the correspondence between two point clouds??
Build ruined 3D mesh:
- Voronoi diagram
- Delaunay triangulation
- Crust in 3D
Post processing:
- normal estimation and filtering
Build the curve when we are given the surface points and the normals??
- triangulation Iso-surface??
Commonly Used Variables in Falcor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
struct ShadingAttribs { float3 P; ///< Shading hit position in world space float3 E; ///< Direction to the eye at shading hit float3 N; ///< Shading normal at shading hit float3 T; ///< Shading tangent at shading hit float3 B; ///< Shading bitangent at shading hit float2 UV; ///< Texture mapping coordinates #ifdef _MS_USER_DERIVATIVES float2 DPDX DEFAULTS(float2(0, 0)); float2 DPDY DEFAULTS(float2(0, 0)); ///< User-provided 2x2 full matrix of duv/dxy derivatives of a shading point footprint in texture space #else float lodBias DEFAULTS(0); ///< LOD bias to use when sampling textures #endif #ifdef _MS_USER_HALF_VECTOR_DERIVATIVES float2 DHDX DEFAULTS(float2(0, 0)); float2 DHDY DEFAULTS(float2(0, 0)); ///< User-defined half-vector derivatives #endif PreparedMaterialData preparedMat; ///< Copy of the original material with evaluated parameters (i.e., textures are fetched etc.) float aoFactor; }; |
136. Single Number
Given an array of integers, every element appears twice except for one. Find that single one.
Solution:
1 2 3 4 5 6 7 8 9 10 11 |
class Solution { public: int singleNumber(vector<int>& nums) { int A = nums[0]; for(int i = 1; i < nums.size();i++) { A = A ^ nums[i]; } return A; } }; |
WTF! I have met this problem before, but I forget how to solve!
CMake Warning at CMakeLists.txt:390 (MESSAGE):
Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: Qt5 DevIL
My Oculus Connect 4
09/22/2017
- The obj file of sponza model has texture coordinates beyond [0,1], it even has negative numbers! When I map it to Gbuffer, the texture2D() just went wrong. So should use vec2 newTextCoord = fract(TextCoord);
I have new keyboard!
Shang gave me a mechanical keyboard, feeling so cool with it!
09/21/2017
- A 99 line global illumination: (path tracing) http://www.kevinbeason.com/smallpt/