x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

SceneCaptureComponent2D Custom Projection Matrix 4.17

Hi,

SceneCaptureComponent2D.h contains the following

     /** Whether a custom projection matrix will be used during rendering. */
     UPROPERTY(BlueprintReadWrite, AdvancedDisplay, Category = Projection)
     bool bUseCustomProjectionMatrix;
 
     /** The custom projection matrix to use */
     UPROPERTY(BlueprintReadWrite, AdvancedDisplay, Category = Projection)
     FMatrix CustomProjectionMatrix;

I have tried deriving from SceneCaptureComponent2D to set a custom Matrix

 #include "ARSceneCaptureComponent2D.h"
 
 void UARSceneCaptureComponent2D::BeginPlay()
 {
     bUseCustomProjectionMatrix = true;
     CustomProjectionMatrix = GenerateOffCenterMatrix(0.0F, 2000.0F, width, 
     height, skew, u0, v0, fx, fy);
 }
 
 FMatrix UARSceneCaptureComponent2D::GenerateOffCenterMatrix(float near, float far, float width, float height, float s, float u0, float v0, float fx, float fy)
 {
     FMatrix out;
     float mat00 = 2.0F * fx / width;
     float mat11 = 2.0F * fy / height;
     float mat02 = (width - 2.0F * u0) / width;
     float mat12 = (-height + 2.0F * v0) / height;
     float mat22 = -(far + near) / (far - near);
     float mat23 = -(2.0F * far * near) / (far - near);
     float mat32 = -1.0F;
     // Setting perspective transformation Matrix
     out.SetIdentity();
     out.M[0][0] = mat00;
     out.M[0][1] = 0;
     out.M[0][2] = mat02;
     out.M[0][3] = 0;
     out.M[1][0] = 0;
     out.M[1][1] = mat11;
     out.M[1][2] = mat12;
     out.M[1][3] = 0;
     out.M[2][0] = 0;
     out.M[2][1] = 0;
     out.M[2][2] = mat22;
     out.M[2][3] = mat23;
     out.M[3][0] = 0;
     out.M[3][1] = 0;
     out.M[3][2] = mat32;
     out.M[3][3] = 0;
     return out;
 }

Sadly my code won't work, the image looks exactly the same with or without setting it. Has anyone tried this before and can tell me how to fix this?

Product Version: UE 4.17
Tags:
more ▼

asked Oct 06 '17 at 08:01 PM in C++ Programming

avatar image

razond
6 1 2 5

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You need to set bUseCustomProjectionMatrix to true to use your custom projection matrix.

more ▼

answered Aug 07 '18 at 08:49 AM

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question