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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Why would two different functions which return exactly the same value cause different results?

Ok, I think this one has broken my brain,

I have a custom SkeletalMeshComponent, and I override GetRenderMatrix().

Now, I have two functions, let's call them GetRenderMatrix_Old() and GetRenderMatrix_New(), both defined as const, and they both return an FMatrix in the form of:

 FMatrix adjTransform = ComponentToWorld.ToMatrixWithScale() * AdjustedViewProjectMatrix * InverseOldViewProjectMatrix
 
 return adjTransform;

Now, when debugging, they both give EXACTLY the same numerical values for the all the components that make up the matrix (ComponentToWorld, AdjustedViewProjectMatrix, InverseOldViewProjectMatrix), as well as the final result (adjTransform ).

What totally breaks my mind is that when using GetRenderMatrix_New() instead of GetRenderMatrix_Old(), the actual rendering of the mesh is totally messed up. Please note that both functions are defined as const (so they cannot change class members) and they take no input parameters.

I am seriously 75WAT here.

Does anyone have any ideas how I can even begin to figure out what is going on here?

Product Version: UE 4.9
Tags:
more ▼

asked Sep 29 '15 at 11:04 PM in C++ Programming

avatar image

staticvoidlol
2.6k 95 41 111

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

The first thing that comes to my mind is that you are accessing resources that reside on the render thread form the game thread, can you please share a bit more about the role of those matrices?

more ▼

answered Oct 01 '15 at 06:12 AM

avatar image

lion032
986 31 80 55

avatar image staticvoidlol Oct 01 '15 at 07:50 PM

Hi lion,

Thanks very much for having a look.

Indeed, there was originally a problem with accessing resources on the game thread from the render thread, however, my workaround included circumventing this and I made a very tiny mistake (in one version the near clipping plane is retrieved from the local Player's Sceneview, which evaluation to 5, whereas in the other function it was hardcoded to 3).

I missed this tiny difference in values when debugging, and nearly broke my brain in the process.

So, all is sorted now. If you'd like to have a look at the thread with all the details, you can find it here,

Thanks again!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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